Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/cli_tools.rb,
lib/extensions/string.rb
Instance Method Summary collapse
- #as_partial ⇒ Object
- #blank? ⇒ Boolean
-
#camelize ⇒ Object
TODO: not really camelize.
- #flag? ⇒ Boolean
- #shift ⇒ Object
- #to_m ⇒ Object
Instance Method Details
#as_partial ⇒ Object
14 15 16 17 18 |
# File 'lib/extensions/string.rb', line 14 def as_partial arr = self.split("/") arr.last[0,0] = "_" arr.join("/") end |
#blank? ⇒ Boolean
2 3 4 |
# File 'lib/extensions/string.rb', line 2 def blank? strip.empty? end |
#camelize ⇒ Object
TODO: not really camelize
11 12 13 |
# File 'lib/extensions/string.rb', line 11 def camelize self[0,1].upcase + self[1, self.length] end |
#flag? ⇒ Boolean
3 |
# File 'lib/cli_tools.rb', line 3 def flag?; self[0,1]=='-' end |
#shift ⇒ Object
4 |
# File 'lib/cli_tools.rb', line 4 def shift; self.slice! 0,1 end |
#to_m ⇒ Object
6 7 8 |
# File 'lib/extensions/string.rb', line 6 def to_m self.split("::").inject(Rbml) { |injection, element| injection.const_get(element) } end |