Class: Exerb::Recipe::ResourceBlock
- Inherits:
-
Object
- Object
- Exerb::Recipe::ResourceBlock
- Defined in:
- lib/exerb/recipe.rb
Overview
#
Defined Under Namespace
Classes: IconBlock, VersionBlock
Instance Attribute Summary collapse
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(block, filename) ⇒ ResourceBlock
constructor
A new instance of ResourceBlock.
Constructor Details
#initialize(block, filename) ⇒ ResourceBlock
Returns a new instance of ResourceBlock.
223 224 225 226 227 |
# File 'lib/exerb/recipe.rb', line 223 def initialize(block, filename) @icon = IconBlock.analyze(block, filename) @version = VersionBlock.analyze(block, filename) raise(Exerb::ExerbError, "#{filename}: unknown field at resource block -- #{block.keys.join(', ')}") unless block.empty? end |
Instance Attribute Details
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
229 230 231 |
# File 'lib/exerb/recipe.rb', line 229 def icon @icon end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
229 230 231 |
# File 'lib/exerb/recipe.rb', line 229 def version @version end |
Class Method Details
.analyze(blocks, filename) ⇒ Object
231 232 233 234 235 236 |
# File 'lib/exerb/recipe.rb', line 231 def self.analyze(blocks, filename) block = blocks.delete("resource") return nil if block.nil? raise(Exerb::ExerbError, "#{filename}: resource block must be Hash object -- #{block.type}") unless block.kind_of?(Hash) return self.new(block, filename) end |