Class: Arrest::Handlers::KeyConverter
- Inherits:
-
Object
- Object
- Arrest::Handlers::KeyConverter
- Defined in:
- lib/arrest/handler.rb
Overview
a converter to transform between the name of the field in the json object and the name of the field in ruby code. Special behaviour is that for an underscored name in ruby a camel cased version in json expected:
ruby -> json
started_at startedAt
Class Method Summary collapse
Class Method Details
.key_from_json(name) ⇒ Object
46 47 48 |
# File 'lib/arrest/handler.rb', line 46 def key_from_json name StringUtils.underscore(name.to_s) end |
.key_to_json(name) ⇒ Object
50 51 52 |
# File 'lib/arrest/handler.rb', line 50 def key_to_json name StringUtils.classify(name.to_s,false) end |