Class: DeepConnect::ClassSpec
- Defined in:
- lib/deep-connect/class-spec-space.rb
Instance Attribute Summary collapse
-
#ancestors ⇒ Object
readonly
Returns the value of attribute ancestors.
-
#csid ⇒ Object
readonly
Returns the value of attribute csid.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #add_method_spec(mspec) ⇒ Object
-
#initialize(klass) ⇒ ClassSpec
constructor
A new instance of ClassSpec.
- #method_spec(method) ⇒ Object
Constructor Details
#initialize(klass) ⇒ ClassSpec
Returns a new instance of ClassSpec.
144 145 146 147 148 149 150 151 |
# File 'lib/deep-connect/class-spec-space.rb', line 144 def initialize(klass) @name = klass.name @csid = klass.object_id ancestors = klass.ancestors ancestors.unshift klass @ancestors = ancestors.collect{|k| k.object_id} @method_specs = {} end |
Instance Attribute Details
#ancestors ⇒ Object (readonly)
Returns the value of attribute ancestors.
155 156 157 |
# File 'lib/deep-connect/class-spec-space.rb', line 155 def ancestors @ancestors end |
#csid ⇒ Object (readonly)
Returns the value of attribute csid.
154 155 156 |
# File 'lib/deep-connect/class-spec-space.rb', line 154 def csid @csid end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
153 154 155 |
# File 'lib/deep-connect/class-spec-space.rb', line 153 def name @name end |
Instance Method Details
#add_method_spec(mspec) ⇒ Object
157 158 159 160 161 162 163 |
# File 'lib/deep-connect/class-spec-space.rb', line 157 def add_method_spec(mspec) if sp = @method_specs[mspec.method] @method_specs[mspec.method].override(mspec) else @method_specs[mspec.method] = mspec end end |
#method_spec(method) ⇒ Object
165 166 167 |
# File 'lib/deep-connect/class-spec-space.rb', line 165 def method_spec(method) @method_specs[method] end |