Sha256: 28f7f9d976f23ba47eb73934491f83eea1517eaeb103683ae652531a4c3c5fc5
Contents?: true
Size: 988 Bytes
Versions: 5
Compression:
Stored size: 988 Bytes
Contents
module Parser module Source ## # @api public # class Map attr_reader :expression def initialize(expression) @expression = expression freeze end def line @expression.line end def column @expression.column end def with_expression(expression_l) with { |map| map.update_expression(expression_l) } end def ==(other) other.class == self.class && instance_variables.map do |ivar| instance_variable_get(ivar) == other.send(:instance_variable_get, ivar) end.reduce(:&) end def to_hash Hash[instance_variables.map do |ivar| [ ivar[1..-1].to_sym, instance_variable_get(ivar) ] end] end protected def with(&block) dup.tap(&block).freeze end def update_expression(expression_l) @expression = expression_l end end end end
Version data entries
5 entries across 5 versions & 1 rubygems