Class: AASM::DslHelper::Proxy

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, valid_keys, source) ⇒ Proxy

Returns a new instance of Proxy.



7
8
9
10
11
12
# File 'lib/aasm/dsl_helper.rb', line 7

def initialize(options, valid_keys, source)
  @valid_keys = valid_keys
  @source = source

  @options = options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



14
15
16
17
18
19
20
21
22
# File 'lib/aasm/dsl_helper.rb', line 14

def method_missing(name, *args, &block)
  if @valid_keys.include?(name)
    options[name] = Array(options[name])
    options[name] << block if block
    options[name] += Array(args)
  else
    @source.send name, *args, &block
  end
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



5
6
7
# File 'lib/aasm/dsl_helper.rb', line 5

def options
  @options
end