Module: Patm

Defined in:
lib/patm.rb

Defined Under Namespace

Modules: DSL Classes: CaseBinder, Match, NoMatchError, Pattern, Rule

Constant Summary collapse

EXACT =
Object.new
PREDEF_GROUP_SIZE =
100

Class Method Summary collapse

Class Method Details

.[](struct_klass) ⇒ Object



526
527
528
# File 'lib/patm.rb', line 526

def self.[](struct_klass)
  Pattern::Struct::Builder.new(struct_klass)
end

._anyObject



502
503
504
# File 'lib/patm.rb', line 502

def self._any
  @any ||= Pattern::Any.new
end

._xsObject



506
507
508
# File 'lib/patm.rb', line 506

def self._xs
  @xs = Pattern::ArrRest.new
end

.exactObject

Use in Hash key. Specify exact match or not.



522
523
524
# File 'lib/patm.rb', line 522

def self.exact
  EXACT
end

.match(plain_pat) ⇒ Object



540
541
542
# File 'lib/patm.rb', line 540

def self.match(plain_pat)
  CaseBinder.new Pattern.build_from(plain_pat)
end

.opt(pat = _any) ⇒ Object

Use in hash value. Mark this pattern is optional.



512
513
514
# File 'lib/patm.rb', line 512

def self.opt(pat = _any)
  Pattern::Opt.new(Pattern.build_from(pat))
end

.or(*pats) ⇒ Object



498
499
500
# File 'lib/patm.rb', line 498

def self.or(*pats)
  Pattern::Or.new(pats.map{|p| Pattern.build_from(p) })
end