Class: GlobalVariable

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/schemas.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



16864
16865
16866
16867
16868
16869
16870
16871
16872
# File 'lib/schemas.rb', line 16864

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    enabled:              d["enabled"],
    key:                  d["key"],
    global_variable_type: d["type"],
    value:                d["value"],
  )
end

.from_json!(json) ⇒ Object



16874
16875
16876
# File 'lib/schemas.rb', line 16874

def self.from_json!(json)
  from_dynamic!(JSON.parse(json))
end

Instance Method Details

#to_dynamicObject



16878
16879
16880
16881
16882
16883
16884
16885
# File 'lib/schemas.rb', line 16878

def to_dynamic
  {
    "enabled" => enabled,
    "key"     => key,
    "type"    => global_variable_type,
    "value"   => value,
  }
end

#to_json(options = nil) ⇒ Object



16887
16888
16889
# File 'lib/schemas.rb', line 16887

def to_json(options = nil)
  JSON.generate(to_dynamic, options)
end