Class: Exerb::Recipe::FileBlock

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

Overview

#

Defined Under Namespace

Classes: FileEntry

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(block, filename) ⇒ FileBlock

Returns a new instance of FileBlock.



328
329
330
331
332
333
334
# File 'lib/exerb/recipe.rb', line 328

def initialize(block, filename)
  @file = {}

  block.each { |internal_name, options|
    @file[internal_name] = FileEntry.new(internal_name, options, filename)
  }
end

Class Method Details

.analyze(blocks, filename) ⇒ Object

Raises:



336
337
338
339
340
341
# File 'lib/exerb/recipe.rb', line 336

def self.analyze(blocks, filename)
  block = blocks.delete("file")
  raise(Exerb::ExerbError, "#{filename}: file block not found") if block.nil?
  raise(Exerb::ExerbError, "#{filename}: file block must be Hash object -- #{block.class}") unless block.kind_of?(Hash)
  return self.new(block, filename)
end

Instance Method Details

#[](key) ⇒ Object



343
344
345
# File 'lib/exerb/recipe.rb', line 343

def [](key)
  return @file[key]
end

#delete(key) ⇒ Object



355
356
357
# File 'lib/exerb/recipe.rb', line 355

def delete(key)
  return @file.delete(key)
end

#each(&block) ⇒ Object



347
348
349
# File 'lib/exerb/recipe.rb', line 347

def each(&block)
  return @file.each(&block)
end

#keysObject



351
352
353
# File 'lib/exerb/recipe.rb', line 351

def keys
  return @file.keys
end