Class: Yoda::Store::Objects::ClassObject

Inherits:
NamespaceObject show all
Defined in:
lib/yoda/store/objects/class_object.rb

Instance Attribute Summary collapse

Attributes inherited from NamespaceObject

#ancestors, #constant_addresses, #instance_method_addresses, #methods, #mixin_addresses

Attributes inherited from Base

#document, #path, #primary_source, #sources, #tag_list

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NamespaceObject

#name

Methods inherited from Base

#==, #address, #eql?, #hash, #merge, #name

Methods included from Serializable

#derive, included, #to_json

Methods included from Addressable

#address

Constructor Details

#initialize(superclass_path: nil, **kwargs) ⇒ ClassObject

Returns a new instance of ClassObject.

Parameters:

  • path (String)
  • superclass_path (String, nil) (defaults to: nil)


15
16
17
18
19
# 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

Instance Attribute Details

#superclass_pathPath? (readonly)

Returns:

  • (Path, nil)


6
7
8
# File 'lib/yoda/store/objects/class_object.rb', line 6

def superclass_path
  @superclass_path
end

Class Method Details

.attr_namesArray<Symbol>

Returns:

  • (Array<Symbol>)


9
10
11
# File 'lib/yoda/store/objects/class_object.rb', line 9

def self.attr_names
  super + %i(superclass_path)
end

Instance Method Details

#kindObject



21
22
23
# File 'lib/yoda/store/objects/class_object.rb', line 21

def kind
  :class
end

#to_hObject



25
26
27
# File 'lib/yoda/store/objects/class_object.rb', line 25

def to_h
  super.merge(superclass_path: superclass_path&.to_s)
end