module Nanoc::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/base/views/mixins/mutable_document_view_mixin.rb, line 21 def []=(key, value) disallowed_value_classes = Set.new([ Nanoc::Int::Item, Nanoc::Int::Layout, Nanoc::ItemWithRepsView, Nanoc::LayoutView, ]) if disallowed_value_classes.include?(value.class) raise DisallowedAttributeValueError.new(value) end unwrap.attributes[key] = value end
identifier=(arg)
click to toggle source
Sets the identifier to the given argument.
@param [String, Nanoc::Identifier] arg
# File lib/nanoc/base/views/mixins/mutable_document_view_mixin.rb, line 38 def identifier=(arg) unwrap.identifier = Nanoc::Identifier.from(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/base/views/mixins/mutable_document_view_mixin.rb, line 47 def update_attributes(hash) hash.each { |k, v| unwrap.attributes[k] = v } self end