Class: ArchSpec::ConstantNode
- Inherits:
-
Object
- Object
- ArchSpec::ConstantNode
- Defined in:
- lib/archspec/model.rb
Instance Attribute Summary collapse
-
#class_methods ⇒ Object
readonly
Returns the value of attribute class_methods.
-
#instance_methods ⇒ Object
readonly
Returns the value of attribute instance_methods.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#method_definitions ⇒ Object
readonly
Returns the value of attribute method_definitions.
-
#mixins ⇒ Object
readonly
Returns the value of attribute mixins.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#superclass ⇒ Object
Returns the value of attribute superclass.
Instance Method Summary collapse
- #add_class_method(name, location:) ⇒ Object
- #add_instance_method(name, location:) ⇒ Object
- #add_mixin(kind, name) ⇒ Object
- #class? ⇒ Boolean
-
#initialize(name:, kind:, path:, location:) ⇒ ConstantNode
constructor
A new instance of ConstantNode.
- #module? ⇒ Boolean
Constructor Details
#initialize(name:, kind:, path:, location:) ⇒ ConstantNode
Returns a new instance of ConstantNode.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/archspec/model.rb', line 36 def initialize(name:, kind:, path:, location:) @name = name @kind = kind @path = path @location = location @instance_methods = Set.new @class_methods = Set.new @method_definitions = [] @mixins = { include: Set.new, prepend: Set.new, extend: Set.new } end |
Instance Attribute Details
#class_methods ⇒ Object (readonly)
Returns the value of attribute class_methods.
33 34 35 |
# File 'lib/archspec/model.rb', line 33 def class_methods @class_methods end |
#instance_methods ⇒ Object (readonly)
Returns the value of attribute instance_methods.
33 34 35 |
# File 'lib/archspec/model.rb', line 33 def instance_methods @instance_methods end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
33 34 35 |
# File 'lib/archspec/model.rb', line 33 def kind @kind end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
33 34 35 |
# File 'lib/archspec/model.rb', line 33 def location @location end |
#method_definitions ⇒ Object (readonly)
Returns the value of attribute method_definitions.
33 34 35 |
# File 'lib/archspec/model.rb', line 33 def method_definitions @method_definitions end |
#mixins ⇒ Object (readonly)
Returns the value of attribute mixins.
33 34 35 |
# File 'lib/archspec/model.rb', line 33 def mixins @mixins end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
33 34 35 |
# File 'lib/archspec/model.rb', line 33 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
33 34 35 |
# File 'lib/archspec/model.rb', line 33 def path @path end |
#superclass ⇒ Object
Returns the value of attribute superclass.
34 35 36 |
# File 'lib/archspec/model.rb', line 34 def superclass @superclass end |
Instance Method Details
#add_class_method(name, location:) ⇒ Object
64 65 66 67 |
# File 'lib/archspec/model.rb', line 64 def add_class_method(name, location:) class_methods.add(name.to_sym) method_definitions << MethodDefinition.new(self.name, name.to_sym, :class, location) end |
#add_instance_method(name, location:) ⇒ Object
59 60 61 62 |
# File 'lib/archspec/model.rb', line 59 def add_instance_method(name, location:) instance_methods.add(name.to_sym) method_definitions << MethodDefinition.new(self.name, name.to_sym, :instance, location) end |
#add_mixin(kind, name) ⇒ Object
69 70 71 |
# File 'lib/archspec/model.rb', line 69 def add_mixin(kind, name) mixins.fetch(kind).add(name) end |
#class? ⇒ Boolean
51 52 53 |
# File 'lib/archspec/model.rb', line 51 def class? kind == :class end |
#module? ⇒ Boolean
55 56 57 |
# File 'lib/archspec/model.rb', line 55 def module? kind == :module end |