Method: XmiHelper.attribute_initial_value

Defined in:
lib/xmimodel/xmihelper.rb

.attribute_initial_value(uml_attribute) ⇒ Object

Get the initial value of an attribute

Returns a String with the value

Raises:

  • (ArgumentError)


155
156
157
158
159
160
161
162
163
164
# File 'lib/xmimodel/xmihelper.rb', line 155

def self.attribute_initial_value(uml_attribute)
	raise ArgumentError.new("Parameter is not a UML:Attribute tag.") if uml_attribute.name != "Attribute"
	uml_expression = uml_attribute.at_xpath('./UML:Attribute.initialValue/UML:Expression')
	
	if uml_expression.nil?
		return ''
	else 
		return uml_expression.attribute('body').to_s.strip
	end
end