Class: Cadenya::Types::VariationAssignment_Tool

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type: nil, tool: nil, id: nil) ⇒ VariationAssignment_Tool

Returns a new instance of VariationAssignment_Tool.



7731
7732
7733
7734
7735
# File 'lib/cadenya/types.rb', line 7731

def initialize(type: nil, tool: nil, id: nil)
  @type = type
  @tool = tool
  @id = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



7729
7730
7731
# File 'lib/cadenya/types.rb', line 7729

def id
  @id
end

#toolObject (readonly)

Returns the value of attribute tool.



7729
7730
7731
# File 'lib/cadenya/types.rb', line 7729

def tool
  @tool
end

#typeObject (readonly)

Returns the value of attribute type.



7729
7730
7731
# File 'lib/cadenya/types.rb', line 7729

def type
  @type
end

Class Method Details

.from_json(data) ⇒ Object



7737
7738
7739
7740
7741
7742
7743
# File 'lib/cadenya/types.rb', line 7737

def self.from_json(data)
  new(
    type: data["type"],
    tool: data["tool"].nil? ? nil : Types::BareMetadata.from_json(data["tool"]),
    id: data["id"],
  )
end

Instance Method Details

#to_hObject



7745
7746
7747
7748
7749
7750
7751
# File 'lib/cadenya/types.rb', line 7745

def to_h
  {
    type: Util.plain(@type),
    tool: Util.plain(@tool),
    id: Util.plain(@id),
  }.reject { |_k, v| v.nil? }
end