class Speculation::RegexSpec

@private

Constants

S

This is a Ruby translation of clojure.spec:

https://github.com/clojure/clojure/blob/master/src/clj/clojure/spec.clj

All credit belongs with Rich Hickey and contributors for their original work.


This is a Ruby translation of clojure.spec:

https://github.com/clojure/clojure/blob/master/src/clj/clojure/spec.clj

All credit belongs with Rich Hickey and contributors for their original work.


This is a Ruby translation of clojure.spec:

https://github.com/clojure/clojure/blob/master/src/clj/clojure/spec.clj

All credit belongs with Rich Hickey and contributors for their original work.


This is a Ruby translation of clojure.spec:

https://github.com/clojure/clojure/blob/master/src/clj/clojure/spec.clj

All credit belongs with Rich Hickey and contributors for their original work.


This is a Ruby translation of clojure.spec:

https://github.com/clojure/clojure/blob/master/src/clj/clojure/spec.clj

All credit belongs with Rich Hickey and contributors for their original work.


This is a Ruby translation of clojure.spec:

https://github.com/clojure/clojure/blob/master/src/clj/clojure/spec.clj

All credit belongs with Rich Hickey and contributors for their original work.


This is a Ruby translation of clojure.spec:

https://github.com/clojure/clojure/blob/master/src/clj/clojure/spec.clj

All credit belongs with Rich Hickey and contributors for their original work.


This is a Ruby translation of clojure.spec:

https://github.com/clojure/clojure/blob/master/src/clj/clojure/spec.clj

All credit belongs with Rich Hickey and contributors for their original work.


This is a Ruby translation of clojure.spec:

https://github.com/clojure/clojure/blob/master/src/clj/clojure/spec.clj

All credit belongs with Rich Hickey and contributors for their original work.


This is a Ruby translation of clojure.spec:

https://github.com/clojure/clojure/blob/master/src/clj/clojure/spec.clj

All credit belongs with Rich Hickey and contributors for their original work.

Public Class Methods

new(regex, gen = nil) click to toggle source
# File lib/speculation/spec/regex_spec.rb, line 13
def initialize(regex, gen = nil)
  @regex = regex
  @gen = gen
end

Public Instance Methods

conform(value) click to toggle source
# File lib/speculation/spec/regex_spec.rb, line 18
def conform(value)
  if value.nil? || Predicates.collection?(value)
    S.re_conform(@regex, value)
  else
    :"Speculation/invalid"
  end
end
explain(path, via, inn, value) click to toggle source
# File lib/speculation/spec/regex_spec.rb, line 30
def explain(path, via, inn, value)
  if value.nil? || Predicates.collection?(value)
    S.re_explain(path, via, inn, @regex, value || [])
  else
    [{ :path => path, :val => value, :via => via, :in => inn }]
  end
end
gen(overrides, path, rmap) click to toggle source
# File lib/speculation/spec/regex_spec.rb, line 42
def gen(overrides, path, rmap)
  return @gen.call if @gen

  S.re_gen(@regex, overrides, path, rmap)
end
unform(value) click to toggle source
# File lib/speculation/spec/regex_spec.rb, line 26
def unform(value)
  S.op_unform(@regex, value)
end
with_gen(gen) click to toggle source
# File lib/speculation/spec/regex_spec.rb, line 38
def with_gen(gen)
  self.class.new(@regex, gen)
end