Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/sandwich/ext/string.rb
Instance Method Summary collapse
- #super_to_i ⇒ Object
- #super_underscore ⇒ Object
- #times(&block) ⇒ Object
- #to_i(*args) ⇒ Object
- #underscore ⇒ Object
Instance Method Details
#super_to_i ⇒ Object
2 |
# File 'lib/sandwich/ext/string.rb', line 2 alias_method :super_to_i, :to_i |
#super_underscore ⇒ Object
3 |
# File 'lib/sandwich/ext/string.rb', line 3 alias_method :super_underscore, :underscore |
#times(&block) ⇒ Object
17 18 19 |
# File 'lib/sandwich/ext/string.rb', line 17 def times(&block) to_i.times(&block) end |
#to_i(*args) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/sandwich/ext/string.rb', line 5 def to_i(*args) case self when "a", "the", "an" then 1 when "no" then 0 else super_to_i(*args) end end |
#underscore ⇒ Object
13 14 15 |
# File 'lib/sandwich/ext/string.rb', line 13 def underscore super_underscore.gsub(/ +/, "_") end |