Class: Dotum::Context
- Inherits:
-
Object
- Object
- Dotum::Context
- Defined in:
- lib/dotum/context.rb
Instance Attribute Summary collapse
-
#depth ⇒ Object
readonly
Returns the value of attribute depth.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#package_dir ⇒ Object
readonly
Returns the value of attribute package_dir.
-
#state_dir ⇒ Object
readonly
Returns the value of attribute state_dir.
-
#target_dir ⇒ Object
readonly
Returns the value of attribute target_dir.
Instance Method Summary collapse
- #attributes ⇒ Object
- #child(new_attributes = {}) ⇒ Object
- #fork(new_attributes = {}) ⇒ Object
-
#initialize(attributes = {}) ⇒ Context
constructor
A new instance of Context.
- #no_remote? ⇒ Boolean
Constructor Details
#initialize(attributes = {}) ⇒ Context
Returns a new instance of Context.
5 6 7 |
# File 'lib/dotum/context.rb', line 5 def initialize(attributes={}) set_attributes(attributes) end |
Instance Attribute Details
#depth ⇒ Object (readonly)
Returns the value of attribute depth.
14 15 16 |
# File 'lib/dotum/context.rb', line 14 def depth @depth end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
13 14 15 |
# File 'lib/dotum/context.rb', line 13 def logger @logger end |
#package_dir ⇒ Object (readonly)
Returns the value of attribute package_dir.
9 10 11 |
# File 'lib/dotum/context.rb', line 9 def package_dir @package_dir end |
#state_dir ⇒ Object (readonly)
Returns the value of attribute state_dir.
11 12 13 |
# File 'lib/dotum/context.rb', line 11 def state_dir @state_dir end |
#target_dir ⇒ Object (readonly)
Returns the value of attribute target_dir.
10 11 12 |
# File 'lib/dotum/context.rb', line 10 def target_dir @target_dir end |
Instance Method Details
#attributes ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/dotum/context.rb', line 20 def attributes result = {} instance_variables.each do |var_name| result[var_name[1..-1].to_sym] = instance_variable_get(var_name) end result end |
#child(new_attributes = {}) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/dotum/context.rb', line 33 def child(new_attributes={}) new_attributes ||= {} new_attributes[:depth] = (@depth || 0) + 1 fork(new_attributes) end |
#fork(new_attributes = {}) ⇒ Object
29 30 31 |
# File 'lib/dotum/context.rb', line 29 def fork(new_attributes={}) self.class.new(attributes.merge(new_attributes || {})) end |
#no_remote? ⇒ Boolean
16 17 18 |
# File 'lib/dotum/context.rb', line 16 def no_remote? @no_remote end |