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 |
# File 'lib/project/rows/base_row.rb', line 4 def initialize(key, ) @key = key @options = @label = .fetch(:label, key.to_s.titleize) 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 @options end |
Instance Method Details
#cell_identifier ⇒ Object
27 28 29 |
# File 'lib/project/rows/base_row.rb', line 27 def cell_identifier cell_type::IDENTIFIER end |
#dealloc ⇒ Object
23 24 25 |
# File 'lib/project/rows/base_row.rb', line 23 def dealloc notification_center.removeObserver(self) end |
#has_value? ⇒ Boolean
31 32 33 |
# File 'lib/project/rows/base_row.rb', line 31 def has_value? cell_type.has_value? end |
#notification_center ⇒ Object
11 12 13 |
# File 'lib/project/rows/base_row.rb', line 11 def notification_center NSNotificationCenter.defaultCenter end |
#observe(notification_name, selector) ⇒ Object
19 20 21 |
# File 'lib/project/rows/base_row.rb', line 19 def observe(notification_name, selector) notification_center.addObserver(self, selector: selector, name: notification_name, object: nil) end |
#post(notification) ⇒ Object
15 16 17 |
# File 'lib/project/rows/base_row.rb', line 15 def post(notification) notification_center.postNotificationName(notification, object: self, userInfo: nil) end |
#update_cell(cell) ⇒ Object
35 36 37 38 39 |
# File 'lib/project/rows/base_row.rb', line 35 def update_cell(cell) cell.key = key cell.label = label cell.placeholder = .fetch(:placeholder, nil) end |