Class: Wool::SexpAnalysis::WoolClass
- Inherits:
-
Object
- Object
- Wool::SexpAnalysis::WoolClass
- Defined in:
- lib/wool/analysis/wool_class.rb
Overview
Wool representation of a class. I named it WoolClass so it wouldn’t clash with regular Class. This links the class to its protocol. It has lists of methods, instance variables, and so on.
Instance Attribute Summary collapse
-
#class_object ⇒ Object
readonly
Returns the value of attribute class_object.
-
#methods ⇒ Object
readonly
Returns the value of attribute methods.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#protocol ⇒ Object
readonly
Returns the value of attribute protocol.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#superclass ⇒ Object
Returns the value of attribute superclass.
Instance Method Summary collapse
- #add_method(method) ⇒ Object
-
#initialize(full_path, scope = Scope::GlobalScope) {|_self| ... } ⇒ WoolClass
constructor
A new instance of WoolClass.
- #signatures ⇒ Object
Constructor Details
#initialize(full_path, scope = Scope::GlobalScope) {|_self| ... } ⇒ WoolClass
Returns a new instance of WoolClass.
10 11 12 13 14 15 16 17 18 |
# File 'lib/wool/analysis/wool_class.rb', line 10 def initialize(full_path, scope = Scope::GlobalScope) @path = full_path @methods = {} @protocol = Protocols::ClassProtocol.new(self) @scope = scope @class_object = Symbol.new(@protocol, self) ProtocolRegistry.add_class_protocol(@protocol) yield self if block_given? end |
Instance Attribute Details
#class_object ⇒ Object (readonly)
Returns the value of attribute class_object.
7 8 9 |
# File 'lib/wool/analysis/wool_class.rb', line 7 def class_object @class_object end |
#methods ⇒ Object (readonly)
Returns the value of attribute methods.
7 8 9 |
# File 'lib/wool/analysis/wool_class.rb', line 7 def methods @methods end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/wool/analysis/wool_class.rb', line 7 def path @path end |
#protocol ⇒ Object (readonly)
Returns the value of attribute protocol.
7 8 9 |
# File 'lib/wool/analysis/wool_class.rb', line 7 def protocol @protocol end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
7 8 9 |
# File 'lib/wool/analysis/wool_class.rb', line 7 def scope @scope end |
#superclass ⇒ Object
Returns the value of attribute superclass.
8 9 10 |
# File 'lib/wool/analysis/wool_class.rb', line 8 def superclass @superclass end |
Instance Method Details
#add_method(method) ⇒ Object
20 21 22 |
# File 'lib/wool/analysis/wool_class.rb', line 20 def add_method(method) @methods[method.name] = method end |
#signatures ⇒ Object
24 25 26 |
# File 'lib/wool/analysis/wool_class.rb', line 24 def signatures @methods.values.map(&:signatures).flatten end |