Class: QueenCheck::Arbitrary
- Inherits:
-
Object
- Object
- QueenCheck::Arbitrary
- Defined in:
- lib/queencheck/arbitrary.rb
Overview
QueenCheck Arbitrary class
Constant Summary collapse
- @@dictionary =
{}
Instance Attribute Summary collapse
-
#gen ⇒ QueenCheck::Gen
readonly
Arbitrary generater.
-
#name ⇒ Symbol or String
readonly
Arbitrary name.
Class Method Summary collapse
-
.from_dic(name) ⇒ QueenCheck::Arbitrary or nil
get arbitrary from dictionary.
-
.to_dic(name, arb) ⇒ Symbol or String
store arbitrary to dictionary.
Instance Method Summary collapse
-
#initialize(name, gen, &block) ⇒ Arbitrary
constructor
new instance of QueenCheck::Arbitrary.
Constructor Details
#initialize(name, gen) ⇒ Arbitrary #initialize(name, &block) ⇒ Arbitrary
new instance of QueenCheck::Arbitrary
37 38 39 40 41 |
# File 'lib/queencheck/arbitrary.rb', line 37 def initialize(name, gen, &block) gen = block || gen @gen = gen.instance_of?(QueenCheck::Gen) ? gen : QueenCheck::Gen.new(&gen) @name = QueenCheck::Arbitrary.to_dic(name, self) end |
Instance Attribute Details
#gen ⇒ QueenCheck::Gen (readonly)
Returns arbitrary generater.
46 47 48 |
# File 'lib/queencheck/arbitrary.rb', line 46 def gen @gen end |
#name ⇒ Symbol or String (readonly)
Returns arbitrary name.
44 45 46 |
# File 'lib/queencheck/arbitrary.rb', line 44 def name @name end |
Class Method Details
.from_dic(name) ⇒ QueenCheck::Arbitrary or nil
get arbitrary from dictionary
62 63 64 65 |
# File 'lib/queencheck/arbitrary.rb', line 62 def self.from_dic(name) name = name.respond_to?(:name) ? name.name : name.to_s @@dictionary[name] end |
.to_dic(name, arb) ⇒ Symbol or String
store arbitrary to dictionary
53 54 55 56 57 |
# File 'lib/queencheck/arbitrary.rb', line 53 def self.to_dic(name, arb) name = name.respond_to?(:name) ? name.name : name.to_s @@dictionary[name] = arb return name end |