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
5 6 7 8 9 10 11 12 |
# File 'app/lib/bridge_cache/plugins/data_transform.rb', line 5 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
14 15 16 17 18 19 |
# File 'app/lib/bridge_cache/plugins/data_transform.rb', line 14 def self.valid_json?(json) json = JSON.parse(json) unless json.instance_of?(Hash) json rescue JSON::ParserError false end |