Class: Sharepoint::ObjectProperties
- Inherits:
-
Object
- Object
- Sharepoint::ObjectProperties
- Defined in:
- lib/sharepoint-properties.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#site ⇒ Object
Returns the value of attribute site.
-
#updated_data ⇒ Object
Returns the value of attribute updated_data.
Instance Method Summary collapse
- #add_properties(properties) ⇒ Object
- #add_property(property, value = nil) ⇒ Object
- #available_properties ⇒ Object
-
#initialize(site, data) ⇒ ObjectProperties
constructor
A new instance of ObjectProperties.
Constructor Details
#initialize(site, data) ⇒ ObjectProperties
Returns a new instance of ObjectProperties.
7 8 9 10 11 12 13 14 15 |
# File 'lib/sharepoint-properties.rb', line 7 def initialize site, data @site = site @data = data @updated_data = Hash.new @properties = Hash.new @properties_names = Array.new @properties_original_names = Array.new initialize_properties end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
5 6 7 |
# File 'lib/sharepoint-properties.rb', line 5 def data @data end |
#site ⇒ Object
Returns the value of attribute site.
5 6 7 |
# File 'lib/sharepoint-properties.rb', line 5 def site @site end |
#updated_data ⇒ Object
Returns the value of attribute updated_data.
5 6 7 |
# File 'lib/sharepoint-properties.rb', line 5 def updated_data @updated_data end |
Instance Method Details
#add_properties(properties) ⇒ Object
36 37 38 39 40 |
# File 'lib/sharepoint-properties.rb', line 36 def add_properties properties properties.each do |property| add_property property end end |
#add_property(property, value = nil) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/sharepoint-properties.rb', line 17 def add_property property, value = nil editable = is_property_editable? property property = property.to_s @data[property] = nil if @data[property].nil? @data[property] = value unless value.nil? @updated_data[property] = value if (@initialize_properties == false) and (editable == true) unless @properties_original_names.include? property @properties_names << property.underscore.to_sym @properties_original_names << property define_singleton_method property.underscore do get_property property end define_singleton_method property.underscore + '=' do |new_value| @data[property] = new_value @updated_data[property] = new_value end if editable == true end end |
#available_properties ⇒ Object
42 43 44 |
# File 'lib/sharepoint-properties.rb', line 42 def available_properties @properties_names end |