Method: OldApiResource::Base.prefix=

Defined in:
lib/old_api_resource/base.rb

.prefix=(value = '/') ⇒ Object



143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/old_api_resource/base.rb', line 143

def prefix=(value = '/')
  prefix_call = value.gsub(/:\w+/) { |key| "\#{URI.escape options[#{key}].to_s}"}
  @prefix_parameters = nil
  silence_warnings do
    instance_eval <<-EOE, __FILE__, __LINE__ + 1
      def prefix_source() "#{value}" end
      def prefix(options={}) "#{prefix_call}" end
    EOE
  end
rescue Exception => e
  logger.error "Couldn't set prefix: #{e}\n #{code}" if logger
  raise
end