Class: EverydayThorUtil::BuilderBuildLists::BuilderHelpers

Inherits:
Object
  • Object
show all
Defined in:
lib/everyday_thor_util/builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ BuilderHelpers

Returns a new instance of BuilderHelpers.



80
81
82
83
# File 'lib/everyday_thor_util/builder.rb', line 80

def initialize(parent)
  @parent  = parent
  @helpers = {}
end

Instance Method Details

#[](name) ⇒ Object



89
90
91
# File 'lib/everyday_thor_util/builder.rb', line 89

def [](name)
  @helpers[name.to_sym]
end

#[]=(name, body) ⇒ Object



93
94
95
96
97
98
99
100
101
# File 'lib/everyday_thor_util/builder.rb', line 93

def []=(name, body)
  if body.nil?
    self.delete(name)
    nil
  else
    @parent.commands.delete(name) if @parent.respond_to?(:commands) && @parent.commands.has_key?(name)
    @helpers[name.to_sym] = body
  end
end

#delete(name) ⇒ Object



107
108
109
# File 'lib/everyday_thor_util/builder.rb', line 107

def delete(name)
  @helpers.delete(name.to_sym)
end

#has_key?(name) ⇒ Boolean

Returns:

  • (Boolean)


103
104
105
# File 'lib/everyday_thor_util/builder.rb', line 103

def has_key?(name)
  @helpers.has_key?(name.to_sym)
end

#helpersObject



85
86
87
# File 'lib/everyday_thor_util/builder.rb', line 85

def helpers
  @helpers
end