Class: Muack::Satisfying
- Inherits:
-
Struct
- Object
- Struct
- Muack::Satisfying
show all
- Defined in:
- lib/muack/satisfying.rb
Defined Under Namespace
Classes: Conj, Disj
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(args = nil, &block) ⇒ Satisfying
Returns a new instance of Satisfying.
6
7
8
|
# File 'lib/muack/satisfying.rb', line 6
def initialize args=nil, &block
super(args, block)
end
|
Instance Attribute Details
#api_args ⇒ Object
Returns the value of attribute api_args
5
6
7
|
# File 'lib/muack/satisfying.rb', line 5
def api_args
@api_args
end
|
#block ⇒ Object
Returns the value of attribute block
5
6
7
|
# File 'lib/muack/satisfying.rb', line 5
def block
@block
end
|
Instance Method Details
#&(rhs) ⇒ Object
15
|
# File 'lib/muack/satisfying.rb', line 15
def & rhs; Satisfying::Conj.new(self, rhs); end
|
#api_name ⇒ Object
48
49
50
51
|
# File 'lib/muack/satisfying.rb', line 48
def api_name
(self.class.name || 'Unknown')[/(::)*(\w+)$/, 2].
gsub(/([A-Z][a-z]*)+?(?=[A-Z][a-z]*)/, '\\1_').downcase
end
|
#match(actual_arg) ⇒ Object
10
11
12
|
# File 'lib/muack/satisfying.rb', line 10
def match actual_arg
!!block.call(actual_arg)
end
|
#to_s ⇒ Object
Also known as:
inspect
43
44
45
|
# File 'lib/muack/satisfying.rb', line 43
def to_s
"Muack::API.#{api_name}(#{api_args.map(&:inspect).join(', ')})"
end
|
#|(rhs) ⇒ Object
14
|
# File 'lib/muack/satisfying.rb', line 14
def | rhs; Satisfying::Disj.new(self, rhs); end
|