Class: Holidays::Definition::Decorator::CustomMethodSource

Inherits:
Object
  • Object
show all
Defined in:
lib/holidays/definition/decorator/custom_method_source.rb

Instance Method Summary collapse

Instance Method Details

#call(proc) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/holidays/definition/decorator/custom_method_source.rb', line 5

def call(proc)
  validate!(proc)

  method_name = proc.name
  args = args_string(proc.arguments)
  source = proc.source

  "\"#{method_name.to_s}(#{args})\" => Proc.new { |#{args}|\n#{source}}"
end