Module: EventInventory::FormatHelper
- Included in:
- Base::Action, Base::Request, ParseHelper::ClassMethods
- Defined in:
- lib/event_inventory/format_helper.rb
Instance Method Summary collapse
-
#format_key(key, old_format = false) ⇒ Object
Formats keys for use in parsing responses and building query strings.
-
#format_query_value(value) ⇒ Object
Formats and escapes query values for use in a query string.
Instance Method Details
#format_key(key, old_format = false) ⇒ Object
Formats keys for use in parsing responses and building query strings.
4 5 6 7 8 9 10 |
# File 'lib/event_inventory/format_helper.rb', line 4 def format_key(key, old_format=false) key = key.to_s key.upcase! if key == 'id' key.gsub!(/_id$/, '_ID') key.gsub!(/_url$/, '_URL') old_format ? key.upcase : key.camelize end |
#format_query_value(value) ⇒ Object
Formats and escapes query values for use in a query string.
13 14 15 16 17 18 19 20 |
# File 'lib/event_inventory/format_helper.rb', line 13 def format_query_value(value) value = case value when Time, Date then value.to_s(:db) else value.to_s end CGI.escape(value) end |