Class: Microstation::Tag

Inherits:
Element show all
Defined in:
lib/microstation/tag.rb

Instance Attribute Summary

Attributes inherited from Element

#ole_obj

Instance Method Summary collapse

Methods inherited from Element

#Type, #_update, convert_item, #has_tags?, #method_missing, #microstation_id, #microstation_type, ole_object?, #text?, #text_node?, #textual?

Constructor Details

#initialize(ole) ⇒ Tag

Returns a new instance of Tag.



5
6
7
8
# File 'lib/microstation/tag.rb', line 5

def initialize(ole)
  @ole_obj = ole
  @original = @ole_obj.Value
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Microstation::Element

Instance Method Details

#base_elementObject



51
52
53
# File 'lib/microstation/tag.rb', line 51

def base_element
  @base_element ||= TaggedElement.new(ole_base_element)
end

#base_element=(ele) ⇒ Object



39
40
41
# File 'lib/microstation/tag.rb', line 39

def base_element=(ele)
  @base_element = ele
end

#base_element_idObject



47
48
49
# File 'lib/microstation/tag.rb', line 47

def base_element_id
  ole_base_element.ID64
end

#nameObject



14
15
16
# File 'lib/microstation/tag.rb', line 14

def name
  @ole_obj.TagDefinitionName
end

#ole_base_elementObject



43
44
45
# File 'lib/microstation/tag.rb', line 43

def ole_base_element
  @ole_obj.BaseElement
end

#ole_valueObject



10
11
12
# File 'lib/microstation/tag.rb', line 10

def ole_value
  @ole_obj.Value
end

#tagsetObject



26
27
28
# File 'lib/microstation/tag.rb', line 26

def tagset
  @ole_obj.TagSetName
end

#tagset_nameObject



30
31
32
# File 'lib/microstation/tag.rb', line 30

def tagset_name
  @ole_obj.TagSetName
end

#to_sObject



18
19
20
# File 'lib/microstation/tag.rb', line 18

def to_s
  "#{name}: #{value} ts ->#{tagset_name}"
end

#update_ole(value) ⇒ Object



34
35
36
37
# File 'lib/microstation/tag.rb', line 34

def update_ole(value)
  value = value.nil? ? "" : value
  @ole_obj.Value = value
end

#valueObject



22
23
24
# File 'lib/microstation/tag.rb', line 22

def value
  @original
end