Class: Yoda::Store::Objects::MetaClassObject

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

Defined Under Namespace

Classes: Connected

Instance Attribute Summary

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

attr_names, #namespace?, #to_h

Methods inherited from Base

#==, attr_names, #eql?, #hash, #merge, #meta_class_address, #namespace?, #parent_address, #to_h, #with_connection

Methods included from Patchable

#to_h

Methods included from Serializable

#==, #derive, #eql?, #hash, included, #to_h, #to_json

Constructor Details

#initialize(**kwargs) ⇒ MetaClassObject

Returns a new instance of MetaClassObject.

Parameters:

  • path (String)
  • document (Document, nil)
  • tag_list (TagList, nil)
  • instance_method_paths (Array<String>)
  • instance_mixin_paths (Array<String>)


43
44
45
# File 'lib/yoda/store/objects/meta_class_object.rb', line 43

def initialize(**kwargs)
  super(**kwargs)
end

Class Method Details

.address_of(path) ⇒ String

Parameters:

  • path (String)

Returns:

  • (String)


22
23
24
# File 'lib/yoda/store/objects/meta_class_object.rb', line 22

def self.address_of(path)
  "#{path}%class"
end

.meta_class_address?(address) ⇒ true, false

Parameters:

  • address (String)

Returns:

  • (true, false)


28
29
30
# File 'lib/yoda/store/objects/meta_class_object.rb', line 28

def self.meta_class_address?(address)
  address.end_with?('%class')
end

.path_of(address) ⇒ String

Parameters:

  • address (String)

Returns:

  • (String)


34
35
36
# File 'lib/yoda/store/objects/meta_class_object.rb', line 34

def self.path_of(address)
  address.sub(/%class$/, '')
end

Instance Method Details

#addressString

Returns:

  • (String)


57
58
59
# File 'lib/yoda/store/objects/meta_class_object.rb', line 57

def address
  MetaClassObject.address_of(path)
end

#base_class_addressString

Returns:

  • (String)


62
63
64
# File 'lib/yoda/store/objects/meta_class_object.rb', line 62

def base_class_address
  path
end

#kindObject



52
53
54
# File 'lib/yoda/store/objects/meta_class_object.rb', line 52

def kind
  :meta_class
end

#nameString

Returns:

  • (String)


48
49
50
# File 'lib/yoda/store/objects/meta_class_object.rb', line 48

def name
  @name ||= path.match(MODULE_TAIL_PATTERN) { |md| md[1] || md[2] }
end