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