Class: Integer

Inherits:
Object
  • Object
show all
Defined in:
lib/string_builder/monkey_patch.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



2
3
4
5
6
# File 'lib/string_builder/monkey_patch.rb', line 2

def method_missing(name, *args, &_block)
  return super unless name.to_s.match?(/\A[a-z_][a-z0-9_]*\z/)

  MethodCallToken.new(self, name, args)
end

Instance Method Details

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/string_builder/monkey_patch.rb', line 8

def respond_to_missing?(name, include_private = false)
  name.to_s.match?(/\A[a-z_][a-z0-9_]*\z/) || super
end

#to_strObject



12
13
14
# File 'lib/string_builder/monkey_patch.rb', line 12

def to_str
  to_s
end