Class: ChoresKit::DefinitionProxy

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ DefinitionProxy



5
6
7
# File 'lib/chores_kit/definition_proxy.rb', line 5

def initialize(name)
  @chore = Chore.new(name)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



9
10
11
12
13
14
15
16
17
# File 'lib/chores_kit/definition_proxy.rb', line 9

def method_missing(name, *args, &block)
  args = {} if args.empty?

  if block_given?
    @chore.send(name, args, &block)
  else
    @chore.send(name, *args)
  end
end

Instance Attribute Details

#choreObject (readonly)

Returns the value of attribute chore.



3
4
5
# File 'lib/chores_kit/definition_proxy.rb', line 3

def chore
  @chore
end