module UniverseCompiler::Entity::Conversion

Public Instance Methods

==(another_reference) click to toggle source
# File lib/universe_compiler/entity/conversion.rb, line 27
def ==(another_reference)
  return false unless another_reference.respond_to? :to_composite_key
  to_composite_key == another_reference.to_composite_key
end
as_path() click to toggle source
# File lib/universe_compiler/entity/conversion.rb, line 8
def as_path
  to_composite_key.map(&:to_s).join '/'
end
encode_with(coder) click to toggle source
# File lib/universe_compiler/entity/conversion.rb, line 49
def encode_with(coder)
  dereferenced_fields.each do |key, value|
    coder[key] = value
  end
end
eql?(another_reference) click to toggle source
# File lib/universe_compiler/entity/conversion.rb, line 32
def eql?(another_reference)
  self == another_reference and universe == another_reference.universe
end
init_with(coder) click to toggle source
# File lib/universe_compiler/entity/conversion.rb, line 55
def init_with(coder)
  initialize
  self.fully_resolved = false
  coder.map.each do |key, value|
    self[key] = value
  end
end
inspect() click to toggle source
# File lib/universe_compiler/entity/conversion.rb, line 20
def inspect
  msg = "#<#{self.class.name}:#{object_id} composite_key=#{to_composite_key.inspect}"
  msg << ", @universe='#{universe.name}'" unless universe.nil?
  msg << '>'
  msg
end
to_composite_key() click to toggle source
# File lib/universe_compiler/entity/conversion.rb, line 12
def to_composite_key
  [type, name]
end
to_hash() click to toggle source
# File lib/universe_compiler/entity/conversion.rb, line 36
def to_hash
  {
      self.class.name => {
          type: type,
          fields: dereferenced_fields
      }
  }
end
to_reference() click to toggle source
# File lib/universe_compiler/entity/conversion.rb, line 45
def to_reference
  UniverseCompiler::Entity::Reference.new_instance self
end
to_uniq_id() click to toggle source
# File lib/universe_compiler/entity/conversion.rb, line 16
def to_uniq_id
  Digest::SHA256.hexdigest to_composite_key.join ':'
end