Class: String
- 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
Direct Known Subclasses
Padrino::Routing::Parent, Padrino::SafeBuffer, TemporaryString
Defined Under Namespace
Classes: Colorizer
Instance Method Summary collapse
- #camelize ⇒ Object
- #classify ⇒ Object
-
#colorize(args) ⇒ Object
colorize(:red).
- #constantize ⇒ Object
- #html_safe ⇒ Object
- #pluralize ⇒ Object
- #underscore ⇒ Object
Instance Method Details
#camelize ⇒ Object
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 |
#classify ⇒ Object
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 |
#constantize ⇒ Object
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_safe ⇒ Object
9 10 11 |
# File 'padrino-helpers/lib/padrino/core_ext/output_safety.rb', line 9 def html_safe SafeBuffer.new(self) end |
#pluralize ⇒ Object
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 |
#underscore ⇒ Object
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 |