class RBS::Location::WithChildren
Attributes
              optional_children[R]
            
            
              required_children[R]
            
            Public Class Methods
                              new(buffer:, start_pos:, end_pos:)
                              click to toggle source
                            
                            
                                  Calls superclass method
                                  
                              RBS::Location::new
                              # File rbs-1.4.0/lib/rbs/location.rb, line 150 def initialize(buffer:, start_pos:, end_pos:) super(buffer: buffer, start_pos: start_pos, end_pos: end_pos) @optional_children = {} @required_children = {} end
Public Instance Methods
                              [](key)
                              click to toggle source
                            
                            # File rbs-1.4.0/lib/rbs/location.rb, line 163 def [](key) case when required_children.key?(_ = key) range = required_children[_ = key] Location.new(buffer: buffer, start_pos: range.begin, end_pos: range.end) when optional_children.key?(_ = key) range = required_children[_ = key] || optional_children[_ = key] if range Location.new(buffer: buffer, start_pos: range.begin, end_pos: range.end) end else raise "Unknown key given: `#{key}`" end end
                              initialize_copy(from)
                              click to toggle source
                            
                            # File rbs-1.4.0/lib/rbs/location.rb, line 157 def initialize_copy(from) required_children.merge!(from.required_children) optional_children.merge!(from.optional_children) self end
                              merge_optional(hash)
                              click to toggle source
                            
                            # File rbs-1.4.0/lib/rbs/location.rb, line 197 def merge_optional(hash) this = dup h = hash.transform_values do |value| case value when Range value when Location value.range else nil end end this.optional_children.merge!(h) this end
                              merge_required(hash)
                              click to toggle source
                            
                            # File rbs-1.4.0/lib/rbs/location.rb, line 178 def merge_required(hash) this = dup h = hash.transform_values do |value| case value when Range value when Location value.range else raise end end this.required_children.merge!(h) this end