Class: Rubrowser::Parser::Relation::Base
- Inherits:
-
Object
- Object
- Rubrowser::Parser::Relation::Base
- Defined in:
- lib/rubrowser/parser/relation/base.rb
Instance Attribute Summary collapse
-
#caller_namespace ⇒ Object
readonly
Returns the value of attribute caller_namespace.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(namespace, caller_namespace, file: nil, line: nil) ⇒ Base
constructor
A new instance of Base.
- #resolve(definitions) ⇒ Object
Constructor Details
#initialize(namespace, caller_namespace, file: nil, line: nil) ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 14 |
# File 'lib/rubrowser/parser/relation/base.rb', line 9 def initialize(namespace, caller_namespace, file: nil, line: nil) @namespace = namespace @caller_namespace = caller_namespace @file = file @line = line end |
Instance Attribute Details
#caller_namespace ⇒ Object (readonly)
Returns the value of attribute caller_namespace.
7 8 9 |
# File 'lib/rubrowser/parser/relation/base.rb', line 7 def caller_namespace @caller_namespace end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
7 8 9 |
# File 'lib/rubrowser/parser/relation/base.rb', line 7 def file @file end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
7 8 9 |
# File 'lib/rubrowser/parser/relation/base.rb', line 7 def line @line end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
7 8 9 |
# File 'lib/rubrowser/parser/relation/base.rb', line 7 def namespace @namespace end |
Instance Method Details
#==(other) ⇒ Object
30 31 32 33 |
# File 'lib/rubrowser/parser/relation/base.rb', line 30 def ==(other) namespace == other.namespace && caller_namespace == other.caller_namespace end |
#resolve(definitions) ⇒ Object
24 25 26 27 28 |
# File 'lib/rubrowser/parser/relation/base.rb', line 24 def resolve(definitions) possibilities.find do |possibility| definitions.any? { |definition| definition == possibility } end || possibilities.last end |