class Functionator def initialize(s) s.split.each { |i| define_singleton_method(i) { Functionator.new(s.split[1..-1].join(' ')) } } end end def functionator(string) Functionator.new(string) end
- class Functionator
- def initialize(s)
s.split(' ').each { | i | define_singleton_method :"#{i}" do Functionator.new(s.split(' ')[1..-1].join(' ')) end }- s.split.each { |i| define_singleton_method(i) { Functionator.new(s.split[1..-1].join(' ')) } }
- end
- end
- def functionator(string)
- Functionator.new(string)
- end