Class: Ernie::Mod

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Mod

Returns a new instance of Mod.



179
180
181
182
# File 'lib/ernie.rb', line 179

def initialize(name)
  self.name = name
  self.funs = {}
end

Instance Attribute Details

#funsObject

Returns the value of attribute funs.



177
178
179
# File 'lib/ernie.rb', line 177

def funs
  @funs
end

#nameObject

Returns the value of attribute name.



177
178
179
# File 'lib/ernie.rb', line 177

def name
  @name
end

Instance Method Details

#fun(name, block) ⇒ Object

Raises:

  • (TypeError)


184
185
186
187
# File 'lib/ernie.rb', line 184

def fun(name, block)
  raise TypeError, "block required" if block.nil?
  self.funs[name] = block
end