Last active
December 17, 2015 15:09
-
-
Save denisdefreyne/5630100 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Nanoc | |
class ContentPiece | |
def initialize(content, attributes, identifier) | |
# Content | |
if content.nil? | |
raise ArgumentError, "attempted to create a #{self.class} with no content/filename (identifier #{@identifier})" | |
elsif content.is_a?(Nanoc::TextualContent) | |
@content = content | |
else | |
@content = Nanoc::TextualContent.new(content.to_s, nil) | |
end | |
# Attributes | |
@attributes = attributes.symbolize_keys_recursively | |
# Identifier | |
if identifier.is_a?(Nanoc::Identifier) | |
@identifier = identifier | |
else | |
@identifier = Nanoc::Identifier.from_string(identifier.to_s) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment