Class: Operation
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#visibility ⇒ Object
readonly
Returns the value of attribute visibility.
Attributes inherited from Tag
Instance Method Summary collapse
- #==(obj) ⇒ Object
- #full_name ⇒ Object
-
#initialize(xml, parent) ⇒ Operation
constructor
A new instance of Operation.
- #parameter_by_name(name) ⇒ Object
- #to_s ⇒ Object
Methods inherited from Tag
Constructor Details
#initialize(xml, parent) ⇒ Operation
Returns a new instance of Operation.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/xmimodel/operation.rb', line 13 def initialize(xml, parent) super(xml, parent) @clazz = parent @name = xml.attribute("name").to_s @visibility = xml.attribute("visibility").to_s @visibility = "private" if @visibility == "" @parameters = Array.new XmiHelper.parameters(xml).each do |uml_parameter| parameter = Parameter.new(uml_parameter, self) @parameters << parameter end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/xmimodel/operation.rb', line 8 def name @name end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
11 12 13 |
# File 'lib/xmimodel/operation.rb', line 11 def parameters @parameters end |
#visibility ⇒ Object (readonly)
Returns the value of attribute visibility.
9 10 11 |
# File 'lib/xmimodel/operation.rb', line 9 def visibility @visibility end |
Instance Method Details
#==(obj) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/xmimodel/operation.rb', line 35 def ==(obj) return false if obj.nil? if String == obj.class full_name == obj else full_name == obj.full_name end end |
#full_name ⇒ Object
44 45 46 |
# File 'lib/xmimodel/operation.rb', line 44 def full_name "#{@clazz.full_name}::#{@name}" end |
#parameter_by_name(name) ⇒ Object
29 30 31 32 33 |
# File 'lib/xmimodel/operation.rb', line 29 def parameter_by_name(name) parameter = @parameters.select{|obj| obj.name == name} return parameter[0] if !parameter.nil? && parameter.size > 0 nil end |
#to_s ⇒ Object
48 49 50 |
# File 'lib/xmimodel/operation.rb', line 48 def to_s "Operation[#{full_name}]" end |