Module: DocumentBuilder::Model::ClassMethods

Defined in:
lib/document_builder/model.rb

Instance Method Summary collapse

Instance Method Details

#attribute(name, xpath = nil, coercion = TextAttribute) ⇒ Object



4
5
6
7
# File 'lib/document_builder/model.rb', line 4

def attribute(name, xpath = nil, coercion = TextAttribute)
  @attributes ||= []
  @attributes << Attribute.new(name, xpath || name.to_s, coercion)
end

#inherited(subclass) ⇒ Object



9
10
11
12
# File 'lib/document_builder/model.rb', line 9

def inherited(subclass)
  subclass.instance_variable_set(:@attributes, @attributes)
  super
end