Class: Most::Box

Inherits:
Object show all
Includes:
FileUtils, MetaProgrammable, BoxHelpers, MemoryOut, OptionsHelpers, PathHelpers, Timeout
Defined in:
lib/most/structures/box.rb

Constant Summary

Constants included from MemoryOut

MemoryOut::CALLER_OFFSET, MemoryOut::THIS_FILE

Instance Method Summary collapse

Methods included from BoxHelpers

#rake, #rake_clean

Methods included from MemoryOut

generic_memory_out, memory, memory_out, total_memory, total_memory_out, virtual_memory, virtual_memory_out

Methods included from OptionsHelpers

#create_options

Methods included from PathHelpers

#path

Methods included from MetaProgrammable

#method_missing

Constructor Details

#initialize(options = Options.new(), entities = {}, globals = [], input = '', &block) ⇒ Box

Returns a new instance of Box.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/most/structures/box.rb', line 64

def initialize(options  = Options.new(),
               entities = {},
               globals  = [],
               input    = '', &block)

  @options  = options
  @entities = entities
  @globals  = globals
  @input    = input

  @result = {}

  instance_eval(&block) if block_given?
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MetaProgrammable

Instance Method Details

#run(step) ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/most/structures/box.rb', line 79

def run(step)
  SERVICES[:environment].state("#{6.w}Executing a test box #{object_id}")
  SERVICES[:environment].state("#{6.w}Step type: #{step.class}")

  result = Report.new("Box: #{object_id}")

  if @options[:tests/:report/:specs]
    result.specs = {:options  => @options,
                    :entities => @entities,
                    :globals  => @globals,
                    :input    => @input}
  end

  result << execute(step)
  
  SERVICES[:environment].state("#{6.w}|--> Finished.")

  result
end