Method: Tanker::InstanceMethods#create_snippet_attribute

Defined in:
lib/tanker.rb

#create_snippet_attribute(key, value) ⇒ Object

dynamically create a snippet read attribute (method)



415
416
417
418
419
# File 'lib/tanker.rb', line 415

def create_snippet_attribute(key, value)
  # method name should something_snippet not snippet_something as the api returns it
  method_name = "#{key.match(/snippet_(\w+)/)[1]}_snippet"
  (class << self; self end).send(:define_method, method_name) { value }
end