Class: Noaidi::Module

Inherits:
Object
  • Object
show all
Includes:
DSL
Defined in:
lib/noaidi/module.rb

Instance Method Summary collapse

Methods included from DSL

#any

Constructor Details

#initializeModule

Returns a new instance of Module.



7
8
9
# File 'lib/noaidi/module.rb', line 7

def initialize
  @funs = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



24
25
26
# File 'lib/noaidi/module.rb', line 24

def method_missing(name, *args)
  find_best_method(name, args).call(*args)
end

Instance Method Details

#fun(name, args = [], &block) ⇒ Object

Raises:



11
12
13
14
15
16
17
18
# File 'lib/noaidi/module.rb', line 11

def fun(name, args=[], &block)
  raise NoBlockGiven unless block_given?
  name = name.to_sym
  f = Fun.new(self, name, args, block)
  @funs[name] ||= []
  @funs[name] << f
  f
end

#inspect_funsObject



20
21
22
# File 'lib/noaidi/module.rb', line 20

def inspect_funs
  @funs.inspect
end