Class: Miasma::Types::Data
- Inherits:
-
Object
- Object
- Miasma::Types::Data
- Includes:
- Utils::Lazy
- Defined in:
- lib/miasma/types/data.rb
Overview
Base data container
Direct Known Subclasses
Models::Compute::Server::Address, Models::LoadBalancer::Balancer::Address, Models::LoadBalancer::Balancer::HealthCheck, Models::LoadBalancer::Balancer::Listener, Models::Orchestration::Stack::Output, Model, ThinModel
Class Method Summary (collapse)
-
+ (Data) from_json(json)
Build new instance from JSON string.
Instance Method Summary (collapse)
-
- (self) from_json(json)
Load model using JSON string.
-
- (self) initialize(args = {})
constructor
Build new data instance.
-
- (String) to_json(*_)
Convert model to JSON string.
Constructor Details
- (self) initialize(args = {})
Build new data instance
17 18 19 20 |
# File 'lib/miasma/types/data.rb', line 17 def initialize(args={}) load_data(args) valid_state end |
Class Method Details
+ (Data) from_json(json)
Build new instance from JSON string
45 46 47 |
# File 'lib/miasma/types/data.rb', line 45 def from_json(json) self.new(MultiJson.load(json).to_smash) end |
Instance Method Details
- (self) from_json(json)
Load model using JSON string
33 34 35 36 37 |
# File 'lib/miasma/types/data.rb', line 33 def from_json(json) load_data( MultiJson.load(json).to_smash ).valid_state end |
- (String) to_json(*_)
Convert model to JSON string
25 26 27 |
# File 'lib/miasma/types/data.rb', line 25 def to_json(*_) MultiJson.dump(attributes) end |