Class: BaseRow
- Inherits:
-
Object
- Object
- BaseRow
- Defined in:
- lib/project/rows/base_row.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #cell_identifier ⇒ Object
- #dealloc ⇒ Object
- #has_value? ⇒ Boolean
-
#initialize(key, options) ⇒ BaseRow
constructor
A new instance of BaseRow.
- #notification_center ⇒ Object
- #observe(notification_name, selector) ⇒ Object
- #post(notification) ⇒ Object
- #update_cell(cell) ⇒ Object
Constructor Details
#initialize(key, options) ⇒ BaseRow
Returns a new instance of BaseRow.
4 5 6 7 8 9 10 |
# File 'lib/project/rows/base_row.rb', line 4 def initialize(key, ) @key = key = @label = .fetch(:label, key.to_s.titleize) @value = .fetch(:value, nil) end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
2 3 4 |
# File 'lib/project/rows/base_row.rb', line 2 def key @key end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
2 3 4 |
# File 'lib/project/rows/base_row.rb', line 2 def label @label end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
2 3 4 |
# File 'lib/project/rows/base_row.rb', line 2 def end |
Instance Method Details
#cell_identifier ⇒ Object
28 29 30 |
# File 'lib/project/rows/base_row.rb', line 28 def cell_identifier cell_type::IDENTIFIER end |
#dealloc ⇒ Object
24 25 26 |
# File 'lib/project/rows/base_row.rb', line 24 def dealloc notification_center.removeObserver(self) end |
#has_value? ⇒ Boolean
32 33 34 |
# File 'lib/project/rows/base_row.rb', line 32 def has_value? cell_type.has_value? end |
#notification_center ⇒ Object
12 13 14 |
# File 'lib/project/rows/base_row.rb', line 12 def notification_center NSNotificationCenter.defaultCenter end |
#observe(notification_name, selector) ⇒ Object
20 21 22 |
# File 'lib/project/rows/base_row.rb', line 20 def observe(notification_name, selector) notification_center.addObserver(self, selector: selector, name: notification_name, object: nil) end |
#post(notification) ⇒ Object
16 17 18 |
# File 'lib/project/rows/base_row.rb', line 16 def post(notification) notification_center.postNotificationName(notification, object: self, userInfo: nil) end |
#update_cell(cell) ⇒ Object
36 37 38 39 40 |
# File 'lib/project/rows/base_row.rb', line 36 def update_cell(cell) cell.key = key cell.label = label cell.placeholder = .fetch(:placeholder, nil) end |