Class: Judge::MessageCollection
- Inherits:
-
Object
- Object
- Judge::MessageCollection
- Includes:
- MessageConfig
- Defined in:
- lib/judge/message_collection.rb
Constant Summary
Constants included from MessageConfig
Judge::MessageConfig::ALLOW_BLANK, Judge::MessageConfig::MESSAGE_MAP
Instance Attribute Summary collapse
-
#amv ⇒ Object
readonly
Returns the value of attribute amv.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #custom_messages? ⇒ Boolean
- #generate_messages! ⇒ Object
-
#initialize(object, method, amv) ⇒ MessageCollection
constructor
A new instance of MessageCollection.
- #to_hash ⇒ Object
Constructor Details
#initialize(object, method, amv) ⇒ MessageCollection
Returns a new instance of MessageCollection.
11 12 13 14 15 16 17 18 19 |
# File 'lib/judge/message_collection.rb', line 11 def initialize(object, method, amv) @object = object @method = method @amv = amv @kind = amv.kind = amv..dup = {} end |
Instance Attribute Details
#amv ⇒ Object (readonly)
Returns the value of attribute amv.
9 10 11 |
# File 'lib/judge/message_collection.rb', line 9 def amv @amv end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
9 10 11 |
# File 'lib/judge/message_collection.rb', line 9 def kind @kind end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
9 10 11 |
# File 'lib/judge/message_collection.rb', line 9 def method @method end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
9 10 11 |
# File 'lib/judge/message_collection.rb', line 9 def object @object end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/judge/message_collection.rb', line 9 def end |
Instance Method Details
#custom_messages? ⇒ Boolean
32 33 34 |
# File 'lib/judge/message_collection.rb', line 32 def amv.respond_to?(:messages_to_lookup) && amv..present? end |
#generate_messages! ⇒ Object
21 22 23 24 25 26 |
# File 'lib/judge/message_collection.rb', line 21 def return if @kind == :uniqueness %w{base options integer custom blank}.each do |type| = .merge(self.send(:"#{type}_messages")) end end |
#to_hash ⇒ Object
28 29 30 |
# File 'lib/judge/message_collection.rb', line 28 def to_hash end |