Class: GitDS::BinaryPropertyDefinition
- Inherits:
-
PropertyDefinition
- Object
- PropertyDefinition
- GitDS::BinaryPropertyDefinition
- Defined in:
- lib/git-ds/model/property.rb
Overview
A definition of a ModelItem property that stores binary data.
Instance Attribute Summary
Attributes inherited from PropertyDefinition
#default_value, #name, #on_fs, #validation_block
Instance Method Summary collapse
-
#get(model, parent_path) ⇒ Object
Read value from ModelItem at path in Model.
-
#set(model, parent_path, value) ⇒ Object
Write a raw binary value to ModelItem at path in Model.
-
#valid?(val) ⇒ Boolean
Raw binary property values are always valid if they are not nil.
Methods inherited from PropertyDefinition
#convert_value, #initialize, #path
Constructor Details
This class inherits a constructor from GitDS::PropertyDefinition
Instance Method Details
#get(model, parent_path) ⇒ Object
Read value from ModelItem at path in Model.
This just returns the raw binary value of the property file contents.
145 146 147 |
# File 'lib/git-ds/model/property.rb', line 145 def get(model, parent_path) model.get_item(path(parent_path)) end |
#set(model, parent_path, value) ⇒ Object
Write a raw binary value to ModelItem at path in Model.
Note: this returns the raw binary data as written to the Property BLOB.
154 155 156 157 |
# File 'lib/git-ds/model/property.rb', line 154 def set(model, parent_path, value) write(model, path(parent_path), value) value end |
#valid?(val) ⇒ Boolean
Raw binary property values are always valid if they are not nil
162 163 164 |
# File 'lib/git-ds/model/property.rb', line 162 def valid?(val) val != nil end |