Module: Hugger::ClassMethods

Defined in:
lib/hugger/huggable.rb

Overview

Haggable class methods

Since:

  • 0.0.1

Instance Method Summary collapse

Instance Method Details

#hug_string(*args) ⇒ Object

Decorates object from given method using the Hugger classes

Parameters:

Since:

  • 0.0.1



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/hugger/huggable.rb', line 25

def hug_string(*args)
  m = Module.new
  args.each do |method|
    m.class_eval "      def \#{method}(*args)\n        Hugger::String.new(super(*args))\n      end\n  STRING_WRAPPER\n  end\n  prepend(m)\nend\n", __FILE__, __LINE__ + 1