Class: Flipper::Exporters::Json::Export
- Inherits:
-
Flipper::Export
- Object
- Flipper::Export
- Flipper::Exporters::Json::Export
- Defined in:
- lib/flipper/exporters/json/export.rb
Overview
Internal: JSON export class that knows how to build features hash from data.
Instance Attribute Summary
Attributes inherited from Flipper::Export
Instance Method Summary collapse
-
#features ⇒ Object
Public: The features hash identical to calling get_all on adapter.
-
#initialize(contents:, version: 1) ⇒ Export
constructor
A new instance of Export.
Methods inherited from Flipper::Export
Constructor Details
#initialize(contents:, version: 1) ⇒ Export
Returns a new instance of Export.
14 15 16 |
# File 'lib/flipper/exporters/json/export.rb', line 14 def initialize(contents:, version: 1) super contents: contents, version: version, format: :json end |
Instance Method Details
#features ⇒ Object
Public: The features hash identical to calling get_all on adapter.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/flipper/exporters/json/export.rb', line 19 def features @features ||= begin features = Typecast.from_json(contents).fetch("features") Typecast.features_hash(features) rescue JSON::ParserError raise JsonError rescue raise InvalidError end end |