Class: Wool::SexpAnalysis::WoolClass

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(full_path, scope = Scope::GlobalScope) {|_self| ... } ⇒ WoolClass

Returns a new instance of WoolClass.

Yields:

  • (_self)

Yield Parameters:



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_objectObject (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

#methodsObject (readonly)

Returns the value of attribute methods.



7
8
9
# File 'lib/wool/analysis/wool_class.rb', line 7

def methods
  @methods
end

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/wool/analysis/wool_class.rb', line 7

def path
  @path
end

#protocolObject (readonly)

Returns the value of attribute protocol.



7
8
9
# File 'lib/wool/analysis/wool_class.rb', line 7

def protocol
  @protocol
end

#scopeObject (readonly)

Returns the value of attribute scope.



7
8
9
# File 'lib/wool/analysis/wool_class.rb', line 7

def scope
  @scope
end

#superclassObject

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

#signaturesObject



24
25
26
# File 'lib/wool/analysis/wool_class.rb', line 24

def signatures
  @methods.values.map(&:signatures).flatten
end