Class: Exerb::Recipe::ResourceBlock::IconBlock::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/exerb/recipe.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(block, filename) ⇒ Entry

Returns a new instance of Entry.

Raises:



255
256
257
258
259
260
261
262
# File 'lib/exerb/recipe.rb', line 255

def initialize(block, filename)
  @width  = block.delete("width")
  @height = block.delete("height")
  @color  = block.delete("color")
  @file   = block.delete("file")

  raise(Exerb::ExerbError, "#{filename}: unknown field at icon block entry -- #{block.keys.join(', ')}") unless block.empty?
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



264
265
266
# File 'lib/exerb/recipe.rb', line 264

def color
  @color
end

#fileObject (readonly)

Returns the value of attribute file.



264
265
266
# File 'lib/exerb/recipe.rb', line 264

def file
  @file
end

#heightObject (readonly)

Returns the value of attribute height.



264
265
266
# File 'lib/exerb/recipe.rb', line 264

def height
  @height
end

#widthObject (readonly)

Returns the value of attribute width.



264
265
266
# File 'lib/exerb/recipe.rb', line 264

def width
  @width
end

Class Method Details

.analyze(block, filename) ⇒ Object

Raises:



266
267
268
269
# File 'lib/exerb/recipe.rb', line 266

def self.analyze(block, filename)
  raise(Exerb::ExerbError, "#{filename}: icon block entry must be Hash object -- #{block.type}") unless block.kind_of?(Hash)
  return self.new(block, filename)
end