Class: String
Instance Method Summary collapse
-
#splitkey? ⇒ Boolean
identifying keys (strings) that represent hierarchical structures, with format “superkey:subkey”.
-
#subkey ⇒ Object
for STRINGS we always interpret the last part as a string (“resource:name” translates to :resource => name).
-
#superkey ⇒ Object
we always interpret the first part as a symbol.
Instance Method Details
#splitkey? ⇒ Boolean
identifying keys (strings) that represent hierarchical structures, with format “superkey:subkey”
3 4 5 |
# File 'lib/data_tools/string.rb', line 3 def splitkey? self =~ /:/ end |
#subkey ⇒ Object
for STRINGS we always interpret the last part as a string (“resource:name” translates to :resource => name)
11 12 13 |
# File 'lib/data_tools/string.rb', line 11 def subkey split(/:/, 2).last end |
#superkey ⇒ Object
we always interpret the first part as a symbol
7 8 9 |
# File 'lib/data_tools/string.rb', line 7 def superkey split(/:/, 2).first.to_sym end |