Class: Logrithm::Spitters::String

Inherits:
Object
  • Object
show all
Defined in:
lib/logrithm/spitters/string.rb

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ String

Returns a new instance of String.



4
5
6
# File 'lib/logrithm/spitters/string.rb', line 4

def initialize(obj)
  @obj = obj
end

Instance Method Details

#formattedObject



8
9
10
11
12
13
14
# File 'lib/logrithm/spitters/string.rb', line 8

def formatted
  case @obj
  when ::String then @obj
  when ::Symbol, ::Regexp then @obj.to_s
  else @obj.inspect
  end
end