module Elasticsearch::Resources::Describable::ClassMethods
Public Instance Methods
attributes()
click to toggle source
# File lib/elasticsearch/resources/describable.rb, line 10 def attributes @attributes ||= superclass.respond_to?(:attributes) ? superclass.attributes.dup : [] end
Protected Instance Methods
define_attributes(*attributes)
click to toggle source
# File lib/elasticsearch/resources/describable.rb, line 16 def define_attributes(*attributes) new_attributes = attributes.collect(&:to_sym) - self.attributes.collect(&:to_sym) self.attributes.concat(new_attributes).tap { |a| define_attribute_helpers(new_attributes) } end
Private Instance Methods
define_attribute_helpers(attributes)
click to toggle source
# File lib/elasticsearch/resources/describable.rb, line 23 def define_attribute_helpers(attributes) attributes.each do |attribute| self.send(:define_method, "#{attribute}") do self.attributes[attribute.to_s] end self.send(:define_method, "#{attribute}=") do |value| self.attributes[attribute.to_s] = value end end end