Class: Propr::Dsl::Check
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(block, m) ⇒ Check
Returns a new instance of Check.
11
12
13
14
|
# File 'lib/propr/dsl/check.rb', line 11
def initialize(block, m)
@context, @m =
Kernel.eval("self", block.binding), m
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
42
43
44
|
# File 'lib/propr/dsl/check.rb', line 42
def method_missing(name, *args, &block)
@context.__send__(name, *args, &block)
end
|
Class Method Details
.wrap(block, m = Propr::Random) ⇒ Object
Generates a monadic action, to be run with Random.eval
7
8
9
|
# File 'lib/propr/dsl/check.rb', line 7
def self.wrap(block, m = Propr::Random)
new(block, m).instance_exec(&block)
end
|
Instance Method Details
#bind(f, &g) ⇒ Object
16
17
18
|
# File 'lib/propr/dsl/check.rb', line 16
def bind(f, &g)
@m.bind(f, &g)
end
|
#guard(*conditions) ⇒ Object
24
25
26
|
# File 'lib/propr/dsl/check.rb', line 24
def guard(*conditions)
@m.guard(*conditions)
end
|
#join(value) ⇒ Object
28
29
30
|
# File 'lib/propr/dsl/check.rb', line 28
def join(value)
@m.join(value)
end
|
#scale(*args) ⇒ Object
36
37
38
|
# File 'lib/propr/dsl/check.rb', line 36
def scale(*args)
@m.scale(*args)
end
|
#sequence(actions) ⇒ Object
32
33
34
|
# File 'lib/propr/dsl/check.rb', line 32
def sequence(actions)
@m.sequence(actions)
end
|
#unit(value) ⇒ Object
20
21
22
|
# File 'lib/propr/dsl/check.rb', line 20
def unit(value)
@m.unit(value)
end
|