Class: Bijou::Environment
- Inherits:
-
Object
- Object
- Bijou::Environment
- Defined in:
- lib/bijou/context.rb
Overview
Represents execution state shared by the execution contexts.
Instance Attribute Summary collapse
-
#component ⇒ Object
Returns the value of attribute component.
-
#trace_buffer ⇒ Object
Returns the value of attribute trace_buffer.
-
#trace_level ⇒ Object
Returns the value of attribute trace_level.
Instance Method Summary collapse
- #get_log ⇒ Object
- #get_trace ⇒ Object
-
#initialize ⇒ Environment
constructor
A new instance of Environment.
-
#log(level, str) ⇒ Object
Logs with carriage return.
-
#log_(level, str) ⇒ Object
Logs without carriage return.
-
#trace(level, str) ⇒ Object
Trace with carriage return.
-
#trace_(level, str) ⇒ Object
Trace without carriage return.
Constructor Details
#initialize ⇒ Environment
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
#component ⇒ Object
Returns the value of attribute component.
111 112 113 |
# File 'lib/bijou/context.rb', line 111 def component @component end |
#trace_buffer ⇒ Object
Returns the value of attribute trace_buffer.
111 112 113 |
# File 'lib/bijou/context.rb', line 111 def trace_buffer @trace_buffer end |
#trace_level ⇒ Object
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_log ⇒ Object
123 124 125 |
# File 'lib/bijou/context.rb', line 123 def get_log @log end |
#get_trace ⇒ Object
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 |