Class: Hold::ObjectCell::PropertyCell

Inherits:
Object
  • Object
show all
Includes:
Cell
Defined in:
lib/hold/interfaces/object_cell.rb

Overview

An implementation of the basic Cell interface designed to wrap a property of an ObjectCell as a Cell itself.

Direct Known Subclasses

ArrayPropertyCell, ObjectPropertyCell

Instance Method Summary collapse

Methods included from Cell

#can_get_class?, #can_set_class?, #get_unless_empty, #set_if_empty, #set_unless_empty, #value, #value=

Constructor Details

#initialize(object_cell, property_name) ⇒ PropertyCell

Returns a new instance of PropertyCell.



70
71
72
73
# File 'lib/hold/interfaces/object_cell.rb', line 70

def initialize(object_cell, property_name)
  @object_cell = object_cell
  @property_name = property_name
end

Instance Method Details

#clearObject



87
88
89
# File 'lib/hold/interfaces/object_cell.rb', line 87

def clear
  @object_cell.clear_property(@property_name)
end

#empty?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/hold/interfaces/object_cell.rb', line 83

def empty?
  !@object_cell.has_property?(@property_name)
end

#getObject



75
76
77
# File 'lib/hold/interfaces/object_cell.rb', line 75

def get
  @object_cell.get_property(@property_name)
end

#set(value) ⇒ Object



79
80
81
# File 'lib/hold/interfaces/object_cell.rb', line 79

def set(value)
  @object_cell.set_property(@property_name, value)
end