Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/greenhat/color.rb,
lib/greenhat/thing/helpers.rb

Overview

Pretty sure this is a bad idea to patch string. mentalized.net/journal/2011/04/14/ruby-how-to-check-if-a-string-is-numeric/

Instance Method Summary collapse

Instance Method Details

#numeric?Boolean

Returns:

  • (Boolean)


45
46
47
48
49
# File 'lib/greenhat/thing/helpers.rb', line 45

def numeric?
  !Float(self).nil?
rescue StandardError
  false
end

#pastel(*args) ⇒ Object



20
21
22
# File 'lib/greenhat/color.rb', line 20

def pastel(*args)
  GreenHat::Color.decorate(args.unshift(self))
end

#unpastelObject



24
25
26
# File 'lib/greenhat/color.rb', line 24

def unpastel
  GreenHat::Color.pastel.strip self
end