Class: TomDoc::Scope
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.
10 11 12 13 14 15 16 |
# File 'lib/tomdoc/scope.rb', line 10 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.
7 8 9 |
# File 'lib/tomdoc/scope.rb', line 7 def class_methods @class_methods end |
#comment ⇒ Object
Returns the value of attribute comment.
7 8 9 |
# File 'lib/tomdoc/scope.rb', line 7 def comment @comment end |
#instance_methods ⇒ Object
Returns the value of attribute instance_methods.
7 8 9 |
# File 'lib/tomdoc/scope.rb', line 7 def instance_methods @instance_methods end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/tomdoc/scope.rb', line 7 def name @name end |
#scopes ⇒ Object
Returns the value of attribute scopes.
8 9 10 |
# File 'lib/tomdoc/scope.rb', line 8 def scopes @scopes end |
Instance Method Details
#[](scope) ⇒ Object
22 23 24 |
# File 'lib/tomdoc/scope.rb', line 22 def [](scope) @scopes[scope] end |
#each(&block) ⇒ Object
30 31 32 |
# File 'lib/tomdoc/scope.rb', line 30 def each(&block) @scopes.each(&block) end |
#inspect ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/tomdoc/scope.rb', line 38 def inspect scopes = @scopes.keys.join(', ') imethods = @instance_methods.inspect cmethods = @class_methods.inspect "<#{name} scopes:[#{scopes}] :#{cmethods}: ##{imethods}#>" end |
#keys ⇒ Object
26 27 28 |
# File 'lib/tomdoc/scope.rb', line 26 def keys @scopes.keys end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/tomdoc/scope.rb', line 34 def to_s inspect end |