Class: Judge::ValidatorCollection
- Inherits:
-
Object
- Object
- Judge::ValidatorCollection
- Includes:
- Enumerable
- Defined in:
- lib/judge/validator_collection.rb
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#validators ⇒ Object
readonly
Returns the value of attribute validators.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(object, method) ⇒ ValidatorCollection
constructor
A new instance of ValidatorCollection.
- #to_json ⇒ Object
Constructor Details
#initialize(object, method) ⇒ ValidatorCollection
9 10 11 12 13 |
# File 'lib/judge/validator_collection.rb', line 9 def initialize(object, method) @object = object @method = method @validators = amvs.map { |amv| Judge::Validator.new(object, method, amv) } end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
7 8 9 |
# File 'lib/judge/validator_collection.rb', line 7 def method @method end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
7 8 9 |
# File 'lib/judge/validator_collection.rb', line 7 def object @object end |
#validators ⇒ Object (readonly)
Returns the value of attribute validators.
7 8 9 |
# File 'lib/judge/validator_collection.rb', line 7 def validators @validators end |
Instance Method Details
#each(&block) ⇒ Object
15 16 17 18 19 |
# File 'lib/judge/validator_collection.rb', line 15 def each(&block) validators.each do |v| block.call(v) end end |
#to_json ⇒ Object
21 22 23 |
# File 'lib/judge/validator_collection.rb', line 21 def to_json validators.map { |v| v.to_hash }.to_json end |