Module: Keyremac::Container

Included in:
Item, Raw, Root
Defined in:
lib/keyremac/base.rb

Overview

container collapse

container collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/keyremac/base.rb', line 52

def method_missing(method_name, *args, &block)
  method_name = method_name.to_s
  if method_name[-1] == '_'
    raw = Raw.new method_name.chomp('_')
    if block
      Keyremac::Focus.set_focus raw do
        raw.instance_eval(&block)
      end
    else
      raw.children = args[0]
    end
    @children << raw
    raw
  else
    raise NoMethodError, method_name
  end
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



46
47
48
# File 'lib/keyremac/base.rb', line 46

def children
  @children
end

Instance Method Details

#add(rule) ⇒ Object



48
49
50
# File 'lib/keyremac/base.rb', line 48

def add(rule)
  children << rule
end