Class: Card::Set::RequiredField
- Inherits:
-
Object
- Object
- Card::Set::RequiredField
- Defined in:
- lib/card/set/required_field.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#parent_set ⇒ Object
readonly
Returns the value of attribute parent_set.
Instance Method Summary collapse
- #add ⇒ Object
- #field_event_name(action) ⇒ Object
-
#initialize(parent_set, field, options = {}) ⇒ RequiredField
constructor
A new instance of RequiredField.
- #parent_event_name ⇒ Object
Constructor Details
#initialize(parent_set, field, options = {}) ⇒ RequiredField
Returns a new instance of RequiredField.
6 7 8 9 10 |
# File 'lib/card/set/required_field.rb', line 6 def initialize parent_set, field, ={} @parent_set = parent_set @field = field @options = end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
4 5 6 |
# File 'lib/card/set/required_field.rb', line 4 def field @field end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/card/set/required_field.rb', line 4 def @options end |
#parent_set ⇒ Object (readonly)
Returns the value of attribute parent_set.
4 5 6 |
# File 'lib/card/set/required_field.rb', line 4 def parent_set @parent_set end |
Instance Method Details
#add ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/card/set/required_field.rb', line 12 def add create_parent_event return unless field_events? define_field_test create_field_events end |
#field_event_name(action) ⇒ Object
24 25 26 27 |
# File 'lib/card/set/required_field.rb', line 24 def field_event_name action [field, "required_by", parent_set.underscored_name, "on", action] .join("__").to_sym end |
#parent_event_name ⇒ Object
20 21 22 |
# File 'lib/card/set/required_field.rb', line 20 def parent_event_name [parent_set.underscored_name, "requires_field", field].join("__").to_sym end |