module OpenXml::Docx::HasProperties::ClassMethods
Public Instance Methods
properties()
click to toggle source
# File lib/openxml/docx/has_properties.rb, line 48 def properties @properties ||= {} end
properties_tag(*args)
click to toggle source
# File lib/openxml/docx/has_properties.rb, line 10 def properties_tag(*args) @properties_tag = args.first if args.any? @properties_tag end
property(name, as: nil)
click to toggle source
# File lib/openxml/docx/has_properties.rb, line 30 def property(name, as: nil) properties[name] = (as || name).to_s class_eval <<-CODE, __FILE__, __LINE__ + 1 def #{name} property_key = "#{name}".to_sym class_name = properties[property_key].split("_").map(&:capitalize).join prop_class = OpenXml::Docx::Properties.const_get class_name if instance_variable_get("@#{name}").nil? instance_variable_set "@#{name}", prop_class.new end instance_variable_get "@#{name}" end CODE end
value_property(name, as: nil)
click to toggle source
# File lib/openxml/docx/has_properties.rb, line 15 def value_property(name, as: nil) attr_reader name properties[name] = (as || name).to_s class_eval <<-CODE, __FILE__, __LINE__ + 1 def #{name}=(value) property_key = "#{name}".to_sym class_name = properties[property_key].split("_").map(&:capitalize).join prop_class = OpenXml::Docx::Properties.const_get class_name instance_variable_set "@#{name}", prop_class.new(value) end CODE end