Class: BridgeCache::Plugins::DataTransform
- Inherits:
-
Object
- Object
- BridgeCache::Plugins::DataTransform
- Defined in:
- app/lib/bridge_cache/plugins/data_transform.rb
Class Method Summary collapse
Class Method Details
.set_bridge_id(row) ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/lib/bridge_cache/plugins/data_transform.rb', line 3 def self.set_bridge_id(row) if row.key?('id') row['bridge_id'] = row['id'] if row.key?('id') row.delete('id') end row end |
.valid_json?(json) ⇒ Boolean
11 12 13 14 15 16 |
# File 'app/lib/bridge_cache/plugins/data_transform.rb', line 11 def self.valid_json?(json) json = JSON.parse(json) unless json.class == Hash return json rescue JSON::ParserError => e return false end |