Class: Bijou::Environment

Inherits:
Object
  • Object
show all
Defined in:
lib/bijou/context.rb

Overview

Represents execution state shared by the execution contexts.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEnvironment

Returns a new instance of Environment.



103
104
105
106
107
108
109
# File 'lib/bijou/context.rb', line 103

def initialize()
  @component = nil
  @trace_level = Log::None
  @trace_buffer = true
  @log = ''
  @trace = ''
end

Instance Attribute Details

#componentObject

Returns the value of attribute component.



111
112
113
# File 'lib/bijou/context.rb', line 111

def component
  @component
end

#trace_bufferObject

Returns the value of attribute trace_buffer.



111
112
113
# File 'lib/bijou/context.rb', line 111

def trace_buffer
  @trace_buffer
end

#trace_levelObject

Returns the value of attribute trace_level.



111
112
113
# File 'lib/bijou/context.rb', line 111

def trace_level
  @trace_level
end

Instance Method Details

#get_logObject



123
124
125
# File 'lib/bijou/context.rb', line 123

def get_log
  @log
end

#get_traceObject



149
150
151
# File 'lib/bijou/context.rb', line 149

def get_trace
  @trace
end

#log(level, str) ⇒ Object

Logs with carriage return.



114
115
116
# File 'lib/bijou/context.rb', line 114

def log(level, str)
  @log << str + "\n"
end

#log_(level, str) ⇒ Object

Logs without carriage return.



119
120
121
# File 'lib/bijou/context.rb', line 119

def log_(level, str)
  @log << str
end

#trace(level, str) ⇒ Object

Trace with carriage return.



128
129
130
131
132
133
134
135
136
# File 'lib/bijou/context.rb', line 128

def trace(level, str)
  if level <= @trace_level
    if @trace_buffer
      @trace << str + "\n"
    else
      puts str
    end
  end
end

#trace_(level, str) ⇒ Object

Trace without carriage return.



139
140
141
142
143
144
145
146
147
# File 'lib/bijou/context.rb', line 139

def trace_(level, str)
  if level <= @trace_level
    if @trace_buffer
      @trace << str
    else
      print str
    end
  end
end