module Nanoc::Core::MutableDocumentViewMixin
Public Instance Methods
[]=(key, value)
click to toggle source
Sets the value for the given attribute.
@param [Symbol] key
@see Hash#[]=
# File lib/nanoc/core/mutable_document_view_mixin.rb, line 28 def []=(key, value) disallowed_value_classes = Set.new([ Nanoc::Core::Item, Nanoc::Core::Layout, Nanoc::Core::CompilationItemView, Nanoc::Core::LayoutView, ]) if disallowed_value_classes.include?(value.class) raise DisallowedAttributeValueError.new(value) end _unwrap.set_attribute(key, value) end
identifier=(arg)
click to toggle source
Sets the identifier to the given argument.
@param [String, Nanoc::Core::Identifier] arg
# File lib/nanoc/core/mutable_document_view_mixin.rb, line 45 def identifier=(arg) _unwrap.identifier = Nanoc::Core::Identifier.from(arg) end
raw_content=(arg)
click to toggle source
# 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)
click to toggle source
Updates the attributes based on the given hash.
@param [Hash] hash
@return [self]
# File lib/nanoc/core/mutable_document_view_mixin.rb, line 54 def update_attributes(hash) hash.each { |k, v| _unwrap.set_attribute(k, v) } self end