module DocumentBuilder::Model::ClassMethods

Public Instance Methods

add_attribute(name, attribute) click to toggle source
# File lib/document_builder/model.rb, line 8
def add_attribute(name, attribute)
 attributes[name.to_sym] = attribute
end
attributes() click to toggle source
# File lib/document_builder/model.rb, line 4
def attributes
  @attributes ||= {}
end
call(document) click to toggle source
# File lib/document_builder/model.rb, line 28
def call(document)
  self.new(document)
end
collection(name, selector: nil, type: nil) click to toggle source
# File lib/document_builder/model.rb, line 20
def collection(name, selector: nil, type: nil)
  add_attribute name, Collection.new(name, selector: selector, type: type)
end
property(name, selector: nil, type: nil) click to toggle source
# File lib/document_builder/model.rb, line 12
def property(name, selector: nil, type: nil)
  add_attribute name, Property.new(name, selector: selector, type: type)
end
root(selector) click to toggle source
# File lib/document_builder/model.rb, line 24
def root(selector)
  @root = selector
end
tag(name, selector: nil, type: nil) click to toggle source
# File lib/document_builder/model.rb, line 16
def tag(name, selector: nil, type: nil)
  add_attribute name, Tag.new(name, selector: selector, type: type)
end