module Mustermann::Concat::Native

Mixin for patterns to support native concatenation. @!visibility private

Public Instance Methods

+(other) click to toggle source

@see Mustermann::Pattern#+ @!visibility private

Calls superclass method
# File lib/mustermann/concat.rb, line 10
def +(other)
  other &&= Mustermann.new(other, type: :identity, **options)
  return super unless native = native_concat(other)
  self.class.new(native, **options)
end

Private Instance Methods

native_concat(other) click to toggle source

@!visibility private

# File lib/mustermann/concat.rb, line 17
def native_concat(other)
  "#{self}#{other}" if native_concat?(other)
end
native_concat?(other) click to toggle source

@!visibility private

# File lib/mustermann/concat.rb, line 22
def native_concat?(other)
  other.class == self.class and other.options == options
end