Class: String

Inherits:
Object show all
Defined in:
padrino-support/lib/padrino-support/core_ext/string/colorize.rb,
padrino-gen/lib/padrino-gen/core_ext/string.rb,
padrino-helpers/lib/padrino/core_ext/output_safety.rb

Overview

Add colors

Defined Under Namespace

Classes: Colorizer

Instance Method Summary collapse

Instance Method Details

#camelizeObject



15
16
17
# File 'padrino-gen/lib/padrino-gen/core_ext/string.rb', line 15

def camelize
  Padrino::Inflections.camelize(TemporaryString.new(to_str)).to_str
end

#classifyObject



19
20
21
# File 'padrino-gen/lib/padrino-gen/core_ext/string.rb', line 19

def classify
  Padrino::Inflections.classify(TemporaryString.new(to_str)).to_str
end

#colorize(args) ⇒ Object

colorize(:red)



6
7
8
9
10
11
12
13
# File 'padrino-support/lib/padrino-support/core_ext/string/colorize.rb', line 6

def colorize(args)
  case args
  when Symbol
    Colorizer.send(args, self)
  when Hash
    Colorizer.send(args[:color], self, args[:mode])
  end
end

#constantizeObject



23
24
25
# File 'padrino-gen/lib/padrino-gen/core_ext/string.rb', line 23

def constantize
  Padrino::Inflections.constantize(TemporaryString.new(to_str))
end

#html_safeObject



9
10
11
# File 'padrino-helpers/lib/padrino/core_ext/output_safety.rb', line 9

def html_safe
  SafeBuffer.new(self)
end

#pluralizeObject



7
8
9
# File 'padrino-gen/lib/padrino-gen/core_ext/string.rb', line 7

def pluralize
  Padrino::Inflections.pluralize(TemporaryString.new(to_str)).to_str
end

#underscoreObject



11
12
13
# File 'padrino-gen/lib/padrino-gen/core_ext/string.rb', line 11

def underscore
  Padrino::Inflections.underscore(TemporaryString.new(to_str)).to_str
end