Module: KeyPath::StringExtensions

Included in:
String
Defined in:
lib/key_path/string/extensions.rb

Overview

Extensions to ‘String`.

Instance Method Summary collapse

Instance Method Details

#is_number?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/key_path/string/extensions.rb', line 18

def is_number?
  true if Float(self) rescue false
end

#is_plural?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/key_path/string/extensions.rb', line 14

def is_plural?
  singularize != self && pluralize == self
end

#is_singular?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/key_path/string/extensions.rb', line 10

def is_singular?
  pluralize != self && singularize == self
end

#to_keypathObject



6
7
8
# File 'lib/key_path/string/extensions.rb', line 6

def to_keypath
  KeyPath::Path.new self
end