Class: Card::Set::RequiredField

Inherits:
Object
  • Object
show all
Defined in:
lib/card/set/required_field.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent_set, field) ⇒ 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_set = ensure_field_set parent_set, field
  @field = field
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



4
5
6
# File 'lib/card/set/required_field.rb', line 4

def field
  @field
end

#field_setObject (readonly)

Returns the value of attribute field_set.



4
5
6
# File 'lib/card/set/required_field.rb', line 4

def field_set
  @field_set
end

#parent_setObject (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

#addObject



12
13
14
15
# File 'lib/card/set/required_field.rb', line 12

def add
  create_parent_event
  create_field_events
end

#field_event_name(action) ⇒ Object



21
22
23
# File 'lib/card/set/required_field.rb', line 21

def field_event_name action
  [field_set.underscore, "required_by", parent_set.underscore, "on", action].join("__").to_sym
end

#parent_event_nameObject



17
18
19
# File 'lib/card/set/required_field.rb', line 17

def parent_event_name
  [parent_set.underscore, "requires_field", field_set.underscore].join("__").to_sym
end