Class: QueenCheck::Condition
- Inherits:
-
Object
- Object
- QueenCheck::Condition
- Defined in:
- lib/queencheck/condition.rb
Overview
QueenCheck condition class
Class Method Summary collapse
-
.empty? ⇒ QueenCheck::Condition
check empty.
-
.equal?(m) ⇒ QueenCheck::Condition
check equal m.
-
.include?(ary) ⇒ QueenCheck::Condition
check value in ary.
-
.instance_of?(klass) ⇒ QueenCheck::Condition
check instance of klass.
-
.nil? ⇒ QueenCheck::Condition
check nil.
-
.not_empty? ⇒ QueenCheck::Condition
not empty?.
-
.not_equal? ⇒ QueenCheck::Condition
not equal?.
-
.not_include? ⇒ QueenCheck::Condition
not include?.
-
.not_instance_of? ⇒ QueenCheck::Condition
not instance_of?.
-
.not_nil? ⇒ QueenCheck::Condition
not nil?.
-
.not_orderd? ⇒ QueenCheck::Condition
not orderd?.
-
.not_respond_to? ⇒ QueenCheck::Condition
not respond_to?.
-
.orderd? ⇒ QueenCheck::Condition
check orderd array.
-
.respond_to?(method) ⇒ QueenCheck::Condition
check respond to method.
Instance Method Summary collapse
-
#initialize {|value| ... } ⇒ Condition
constructor
A new instance of Condition.
-
#match?(n) ⇒ Boolean
Condition matched.
Constructor Details
#initialize {|value| ... } ⇒ Condition
Returns a new instance of Condition.
8 9 10 |
# File 'lib/queencheck/condition.rb', line 8 def initialize(&condition) @condition = condition end |
Class Method Details
.empty? ⇒ QueenCheck::Condition
check empty
86 87 88 89 90 |
# File 'lib/queencheck/condition.rb', line 86 def self.empty?() new { |n| n.empty? } end |
.equal?(m) ⇒ QueenCheck::Condition
check equal m
96 97 98 99 100 |
# File 'lib/queencheck/condition.rb', line 96 def self.equal?(m) new { |n| n == m } end |
.include?(ary) ⇒ QueenCheck::Condition
check value in ary
48 49 50 51 52 |
# File 'lib/queencheck/condition.rb', line 48 def self.include?(ary) new { |n| ary.include?(n) } end |
.instance_of?(klass) ⇒ QueenCheck::Condition
check instance of klass
58 59 60 61 62 |
# File 'lib/queencheck/condition.rb', line 58 def self.instance_of?(klass) new { |n| n.instance_of?(klass) } end |
.nil? ⇒ QueenCheck::Condition
check nil
77 78 79 80 81 |
# File 'lib/queencheck/condition.rb', line 77 def self.nil?() new { |n| n.nil? } end |
.not_empty? ⇒ QueenCheck::Condition
not empty?
91 |
# File 'lib/queencheck/condition.rb', line 91 def_not :empty? |
.not_equal? ⇒ QueenCheck::Condition
not equal?
101 |
# File 'lib/queencheck/condition.rb', line 101 def_not :equal? |
.not_include? ⇒ QueenCheck::Condition
not include?
53 |
# File 'lib/queencheck/condition.rb', line 53 def_not :include? |
.not_instance_of? ⇒ QueenCheck::Condition
not instance_of?
63 |
# File 'lib/queencheck/condition.rb', line 63 def_not :instance_of? |
.not_nil? ⇒ QueenCheck::Condition
not nil?
82 |
# File 'lib/queencheck/condition.rb', line 82 def_not :nil? |
.not_orderd? ⇒ QueenCheck::Condition
not orderd?
110 |
# File 'lib/queencheck/condition.rb', line 110 def_not :orderd? |
.not_respond_to? ⇒ QueenCheck::Condition
not respond_to?
73 |
# File 'lib/queencheck/condition.rb', line 73 def_not :respond_to? |
.orderd? ⇒ QueenCheck::Condition
check orderd array
105 106 107 108 109 |
# File 'lib/queencheck/condition.rb', line 105 def self.orderd? new { |n| n.sort == n } end |
.respond_to?(method) ⇒ QueenCheck::Condition
check respond to method
68 69 70 71 72 |
# File 'lib/queencheck/condition.rb', line 68 def self.respond_to?(method) new { |n| n.respond_to?(method) } end |
Instance Method Details
#match?(n) ⇒ Boolean
Returns condition matched.
14 15 16 |
# File 'lib/queencheck/condition.rb', line 14 def match?(n) @condition.call(n) end |