Class: Rubrowser::Parser::Definition::Base
- Inherits:
-
Object
- Object
- Rubrowser::Parser::Definition::Base
- Defined in:
- lib/rubrowser/parser/definition/base.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
- #circular? ⇒ Boolean
-
#initialize(namespace, file: nil, line: nil, lines: 0) ⇒ Base
constructor
A new instance of Base.
- #kernel? ⇒ Boolean
- #name ⇒ Object
- #parent ⇒ Object
- #set_circular ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(namespace, file: nil, line: nil, lines: 0) ⇒ Base
Returns a new instance of Base.
7 8 9 10 11 12 13 |
# File 'lib/rubrowser/parser/definition/base.rb', line 7 def initialize(namespace, file: nil, line: nil, lines: 0) @namespace = Array(namespace) @file = file @line = line @lines = lines @circular = false end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
5 6 7 |
# File 'lib/rubrowser/parser/definition/base.rb', line 5 def file @file end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
5 6 7 |
# File 'lib/rubrowser/parser/definition/base.rb', line 5 def line @line end |
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
5 6 7 |
# File 'lib/rubrowser/parser/definition/base.rb', line 5 def lines @lines end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
5 6 7 |
# File 'lib/rubrowser/parser/definition/base.rb', line 5 def namespace @namespace end |
Instance Method Details
#<=>(other) ⇒ Object
39 40 41 |
# File 'lib/rubrowser/parser/definition/base.rb', line 39 def <=>(other) to_s <=> other.to_s end |
#==(other) ⇒ Object
35 36 37 |
# File 'lib/rubrowser/parser/definition/base.rb', line 35 def ==(other) namespace == other.namespace end |
#circular? ⇒ Boolean
27 28 29 |
# File 'lib/rubrowser/parser/definition/base.rb', line 27 def circular? @circular end |
#kernel? ⇒ Boolean
23 24 25 |
# File 'lib/rubrowser/parser/definition/base.rb', line 23 def kernel? namespace.empty? end |
#name ⇒ Object
15 16 17 |
# File 'lib/rubrowser/parser/definition/base.rb', line 15 def name namespace.last end |
#parent ⇒ Object
19 20 21 |
# File 'lib/rubrowser/parser/definition/base.rb', line 19 def parent new(namespace[0...-1]) end |
#set_circular ⇒ Object
31 32 33 |
# File 'lib/rubrowser/parser/definition/base.rb', line 31 def set_circular @circular = true end |
#to_s ⇒ Object
43 44 45 |
# File 'lib/rubrowser/parser/definition/base.rb', line 43 def to_s namespace.join('::') end |