Class: Lemon::SourceParser::Scope
- Inherits:
-
Object
- Object
- Lemon::SourceParser::Scope
- Includes:
- Enumerable
- Defined in:
- lib/lemon/coverage/source_parser.rb
Overview
A Scope is a Module or Class. It may contain other scopes.
Instance Attribute Summary collapse
-
#class_methods ⇒ Object
Returns the value of attribute class_methods.
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#instance_methods ⇒ Object
Returns the value of attribute instance_methods.
-
#name ⇒ Object
Returns the value of attribute name.
-
#scopes ⇒ Object
Returns the value of attribute scopes.
Instance Method Summary collapse
- #[](scope) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(name, comment = '', instance_methods = [], class_methods = []) ⇒ Scope
constructor
A new instance of Scope.
- #inspect ⇒ Object
- #keys ⇒ Object
- #to_s ⇒ Object
- #tomdoc ⇒ Object
Constructor Details
#initialize(name, comment = '', instance_methods = [], class_methods = []) ⇒ Scope
Returns a new instance of Scope.
157 158 159 160 161 162 163 |
# File 'lib/lemon/coverage/source_parser.rb', line 157 def initialize(name, comment = '', instance_methods = [], class_methods = []) @name = name @comment = comment @instance_methods = instance_methods @class_methods = class_methods @scopes = {} end |
Instance Attribute Details
#class_methods ⇒ Object
Returns the value of attribute class_methods.
154 155 156 |
# File 'lib/lemon/coverage/source_parser.rb', line 154 def class_methods @class_methods end |
#comment ⇒ Object
Returns the value of attribute comment.
154 155 156 |
# File 'lib/lemon/coverage/source_parser.rb', line 154 def comment @comment end |
#instance_methods ⇒ Object
Returns the value of attribute instance_methods.
154 155 156 |
# File 'lib/lemon/coverage/source_parser.rb', line 154 def instance_methods @instance_methods end |
#name ⇒ Object
Returns the value of attribute name.
154 155 156 |
# File 'lib/lemon/coverage/source_parser.rb', line 154 def name @name end |
#scopes ⇒ Object
Returns the value of attribute scopes.
155 156 157 |
# File 'lib/lemon/coverage/source_parser.rb', line 155 def scopes @scopes end |
Instance Method Details
#[](scope) ⇒ Object
169 170 171 |
# File 'lib/lemon/coverage/source_parser.rb', line 169 def [](scope) @scopes[scope] end |
#each(&block) ⇒ Object
177 178 179 |
# File 'lib/lemon/coverage/source_parser.rb', line 177 def each(&block) @scopes.each(&block) end |
#inspect ⇒ Object
185 186 187 188 189 190 191 |
# File 'lib/lemon/coverage/source_parser.rb', line 185 def inspect scopes = @scopes.keys.join(', ') imethods = @instance_methods.inspect cmethods = @class_methods.inspect "<#{name} scopes:[#{scopes}] :#{cmethods}: ##{imethods}#>" end |
#keys ⇒ Object
173 174 175 |
# File 'lib/lemon/coverage/source_parser.rb', line 173 def keys @scopes.keys end |
#to_s ⇒ Object
181 182 183 |
# File 'lib/lemon/coverage/source_parser.rb', line 181 def to_s inspect end |
#tomdoc ⇒ Object
165 166 167 |
# File 'lib/lemon/coverage/source_parser.rb', line 165 def tomdoc @tomdoc ||= TomDoc.new(@comment) end |