Module: FeCoreExt::CoreExt::String
- Included in:
- String
- Defined in:
- lib/fe_core_ext/core_ext/string.rb
Instance Method Summary collapse
- #match?(str) ⇒ Boolean
- #not_number? ⇒ Boolean
- #to_decimal ⇒ Object
- #to_integer ⇒ Object
- #to_katakana ⇒ Object
- #zen_to_han ⇒ Object
Instance Method Details
#match?(str) ⇒ Boolean
30 31 32 |
# File 'lib/fe_core_ext/core_ext/string.rb', line 30 def match?(str) /#{str}/ === self end |
#not_number? ⇒ Boolean
18 19 20 |
# File 'lib/fe_core_ext/core_ext/string.rb', line 18 def not_number? to_i == 0 && match('0').nil? end |
#to_decimal ⇒ Object
13 14 15 16 |
# File 'lib/fe_core_ext/core_ext/string.rb', line 13 def to_decimal return if not_number? delete(',').to_d end |
#to_integer ⇒ Object
8 9 10 11 |
# File 'lib/fe_core_ext/core_ext/string.rb', line 8 def to_integer return if not_number? delete(',').to_i end |
#to_katakana ⇒ Object
26 27 28 |
# File 'lib/fe_core_ext/core_ext/string.rb', line 26 def to_katakana tr('ぁ-ん', 'ァ-ン') end |
#zen_to_han ⇒ Object
22 23 24 |
# File 'lib/fe_core_ext/core_ext/string.rb', line 22 def zen_to_han tr('0-9A-Za-z &・-()', '0-9A-Za-z &・\-()') end |