Module: Nanoc::Core::MutableDocumentViewMixin
- Included in:
- MutableItemView, MutableLayoutView
- Defined in:
- lib/nanoc/core/mutable_document_view_mixin.rb
Defined Under Namespace
Classes: DisallowedAttributeValueError
Instance Method Summary collapse
-
#[]=(key, value) ⇒ Object
Sets the value for the given attribute.
-
#identifier=(arg) ⇒ Object
Sets the identifier to the given argument.
- #raw_content=(arg) ⇒ Object
-
#update_attributes(hash) ⇒ self
Updates the attributes based on the given hash.
Instance Method Details
#[]=(key, value) ⇒ Object
Sets the value for the given attribute.
28 29 30 31 32 33 34 |
# File 'lib/nanoc/core/mutable_document_view_mixin.rb', line 28 def []=(key, value) if disallowed_value_class?(value.class) raise DisallowedAttributeValueError.new(value) end _unwrap.set_attribute(key, value) end |
#identifier=(arg) ⇒ Object
Sets the identifier to the given argument.
39 40 41 |
# File 'lib/nanoc/core/mutable_document_view_mixin.rb', line 39 def identifier=(arg) _unwrap.identifier = Nanoc::Core::Identifier.from(arg) end |
#raw_content=(arg) ⇒ Object
19 20 21 |
# File 'lib/nanoc/core/mutable_document_view_mixin.rb', line 19 def raw_content=(arg) _unwrap.content = Nanoc::Core::Content.create(arg) end |
#update_attributes(hash) ⇒ self
Updates the attributes based on the given hash.
48 49 50 51 |
# File 'lib/nanoc/core/mutable_document_view_mixin.rb', line 48 def update_attributes(hash) hash.each { |k, v| _unwrap.set_attribute(k, v) } self end |