Module: Friendly::Document::Attributes::ClassMethods

Defined in:
lib/friendly/document/attributes.rb

Instance Method Summary collapse

Instance Method Details

#attribute(name, type = nil, options = {}) ⇒ Object



10
11
12
# File 'lib/friendly/document/attributes.rb', line 10

def attribute(name, type = nil, options = {})
  attributes[name] = Attribute.new(self, name, type, options)
end

#attributesObject



14
15
16
# File 'lib/friendly/document/attributes.rb', line 14

def attributes
  @attributes ||= {}
end

#new_without_change_tracking(attributes) ⇒ Object



18
19
20
21
22
# File 'lib/friendly/document/attributes.rb', line 18

def new_without_change_tracking(attributes)
  doc = new(attributes)
  doc.reset_changes
  doc
end