Class: Module

Inherits:
Object show all
Defined in:
lib/aws/s3/extensions.rb

Instance Method Summary collapse

Instance Method Details

#constant(name, value) ⇒ Object


190
191
192
193
194
195
196
197
198
199
# File 'lib/aws/s3/extensions.rb', line 190

def constant(name, value)
  unless const_defined?(name)
    const_set(name, value) 
    module_eval("def self.\#{name.to_s.downcase}\n\#{name.to_s}\nend\n", __FILE__, __LINE__)
  end
end

#memoized(method_name) ⇒ Object


178
179
180
181
182
183
184
185
186
187
188
# File 'lib/aws/s3/extensions.rb', line 178

def memoized(method_name)
  original_method = "unmemoized_#{method_name}_#{Time.now.to_i}"
  alias_method original_method, method_name
  module_eval("def \#{method_name}(reload = false, *args, &block)\nexpirable_memoize(reload) do\nsend(:\#{original_method}, *args, &block)\nend\nend\n", __FILE__, __LINE__)
end