Class: Dotum::Context

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#depthObject (readonly)

Returns the value of attribute depth.



14
15
16
# File 'lib/dotum/context.rb', line 14

def depth
  @depth
end

#loggerObject (readonly)

Returns the value of attribute logger.



13
14
15
# File 'lib/dotum/context.rb', line 13

def logger
  @logger
end

#package_dirObject (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_dirObject (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_dirObject (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

#attributesObject



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

Returns:

  • (Boolean)


16
17
18
# File 'lib/dotum/context.rb', line 16

def no_remote?
  @no_remote
end