Class: ActiveRemote::Cached::ArgumentKeys
- Inherits:
-
Object
- Object
- ActiveRemote::Cached::ArgumentKeys
- Defined in:
- lib/active_remote/cached/argument_keys.rb
Constant Summary collapse
- REMOVE_CHARACTERS =
/[[:space:]+=><{}\[\];:\-,]/
- REPLACE_MAP =
[ [' ', 'SP'], ['+', 'PL'], ['=', 'EQ'], ['>', 'GT'], ['<', 'LT'], ['{', 'LB'], ['}', 'RB'], ['[', 'LB2'], [']', 'RB2'], [';', 'SC'], [':', 'CO'], ['-', 'DA'], [',', 'COM'] ].freeze
Instance Attribute Summary collapse
-
#argument_string ⇒ Object
readonly
Returns the value of attribute argument_string.
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #cache_key ⇒ Object
-
#initialize(*arguments, options) ⇒ ArgumentKeys
constructor
A new instance of ArgumentKeys.
- #to_s ⇒ Object
Constructor Details
#initialize(*arguments, options) ⇒ ArgumentKeys
Returns a new instance of ArgumentKeys.
23 24 25 26 27 28 29 30 31 |
# File 'lib/active_remote/cached/argument_keys.rb', line 23 def initialize(*arguments, ) @options = @arguments = arguments.flatten.compact @argument_string = '' @arguments.each do |argument| @argument_string << argument.to_s end end |
Instance Attribute Details
#argument_string ⇒ Object (readonly)
Returns the value of attribute argument_string.
4 5 6 |
# File 'lib/active_remote/cached/argument_keys.rb', line 4 def argument_string @argument_string end |
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
4 5 6 |
# File 'lib/active_remote/cached/argument_keys.rb', line 4 def arguments @arguments end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/active_remote/cached/argument_keys.rb', line 4 def @options end |
Instance Method Details
#cache_key ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/active_remote/cached/argument_keys.rb', line 33 def cache_key return @argument_string.gsub(REMOVE_CHARACTERS, '') if remove_characters? if replace_characters? REPLACE_MAP.each do |character, replacement| @argument_string.gsub!(character, replacement) end end @argument_string end |
#to_s ⇒ Object
45 46 47 |
# File 'lib/active_remote/cached/argument_keys.rb', line 45 def to_s cache_key end |