Class: OpenXml::Docx::Properties::BaseProperty

Inherits:
Object
  • Object
show all
Defined in:
lib/openxml/docx/properties/base_property.rb

Direct Known Subclasses

ComplexProperty, ContainerProperty, Tab, ValueProperty

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.property_nameObject (readonly)

Returns the value of attribute property_name.



8
9
10
# File 'lib/openxml/docx/properties/base_property.rb', line 8

def property_name
  @property_name
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/openxml/docx/properties/base_property.rb', line 5

def value
  @value
end

Class Method Details

.name(*args) ⇒ Object



15
16
17
18
# File 'lib/openxml/docx/properties/base_property.rb', line 15

def name(*args)
  @property_name = args.first if args.any?
  @name
end

.tag(*args) ⇒ Object



10
11
12
13
# File 'lib/openxml/docx/properties/base_property.rb', line 10

def tag(*args)
  @tag = args.first if args.any?
  @tag
end

Instance Method Details

#default_nameObject



29
30
31
# File 'lib/openxml/docx/properties/base_property.rb', line 29

def default_name
  class_name.gsub(/(.)([A-Z])/, '\1_\2').downcase
end

#default_tagObject



37
38
39
# File 'lib/openxml/docx/properties/base_property.rb', line 37

def default_tag
  (class_name[0, 1].downcase + class_name[1..-1]).to_sym
end

#nameObject



25
26
27
# File 'lib/openxml/docx/properties/base_property.rb', line 25

def name
  self.class.property_name || default_name
end

#render?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/openxml/docx/properties/base_property.rb', line 21

def render?
  !value.nil?
end

#tagObject



33
34
35
# File 'lib/openxml/docx/properties/base_property.rb', line 33

def tag
  self.class.tag || default_tag
end