class Yoda::Store::Objects::ClassObject

Attributes

superclass_path[R]

@return [Path, nil]

Public Class Methods

attr_names() click to toggle source

@return [Array<Symbol>]

Calls superclass method
# File lib/yoda/store/objects/class_object.rb, line 9
def self.attr_names
  super + %i(superclass_path)
end
new(superclass_path: nil, **kwargs) click to toggle source

@param path [String] @param superclass_path [String, nil]

Calls superclass method
# File lib/yoda/store/objects/class_object.rb, line 15
def initialize(superclass_path: nil, **kwargs)
  super(kwargs)

  @superclass_path = Model::Path.new(superclass_path) if superclass_path
end

Public Instance Methods

kind() click to toggle source
# File lib/yoda/store/objects/class_object.rb, line 21
def kind
  :class
end
to_h() click to toggle source
Calls superclass method
# File lib/yoda/store/objects/class_object.rb, line 25
def to_h
  super.merge(superclass_path: superclass_path&.to_s)
end

Private Instance Methods

merge_attributes(another) click to toggle source

@param another [self] @return [Hash]

Calls superclass method
# File lib/yoda/store/objects/class_object.rb, line 33
def merge_attributes(another)
  super.merge(
    superclass_path: select_superclass(another.superclass_path)&.to_s,
  )
end
select_superclass(another) click to toggle source

@param another [ScopedPath] @return [Path]

# File lib/yoda/store/objects/class_object.rb, line 41
def select_superclass(another)
  if %w(Object Exception).include?(another&.to_s)
    superclass_path || another
  else
    another || superclass_path
  end
end