Class: Microstation::Tag

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

Instance Attribute Summary

Attributes inherited from Element

#app, #ole_obj, #original

Instance Method Summary collapse

Methods inherited from Element

#[], #app_ole_obj, convert_item, #do_update, #each, #each_cell, #each_complex, #get_property_handler, #in_cell?, #initialize, #method_missing, #ole_cell, ole_object?, #property_handler, #redraw, #update, #updated?

Methods included from ElementTrait

#cell?, #complex?, #graphical?, #has_tags?, #id_from_record, #line?, #microstation_id, #microstation_type, #model, #parent, #select, #text?, #text_node?, #textual?, #to_ole

Constructor Details

This class inherits a constructor from Microstation::Element

Dynamic Method Handling

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

Instance Method Details

#base_elementObject



79
80
81
# File 'lib/microstation/tag.rb', line 79

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

#base_element=(ele) ⇒ Object



58
59
60
# File 'lib/microstation/tag.rb', line 58

def base_element=(ele)
  @base_element = ele
end

#base_element_idObject



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/microstation/tag.rb', line 66

def base_element_id
  base = ole_base_element
  id = base.Id || base.ID64 rescue nil
  if id.class == WIN32OLE_RECORD
    if id.Low > id.High
      return id.Low
    else
      return id.High
    end
  end
  id
end

#inspectObject



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

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

#nameObject



28
29
30
# File 'lib/microstation/tag.rb', line 28

def name
  @ole_obj.TagDefinitionName
end

#ole_base_elementObject



62
63
64
# File 'lib/microstation/tag.rb', line 62

def ole_base_element
  @ole_obj.BaseElement
end

#ole_valueObject



24
25
26
# File 'lib/microstation/tag.rb', line 24

def ole_value
  @ole_obj.Value
end

#read_ole(ole) ⇒ Object

def initialize(ole)

@ole_obj = ole
@original = @ole_obj.Value

end



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

def read_ole(ole)
  ole.Value
end

#tagsetObject



45
46
47
# File 'lib/microstation/tag.rb', line 45

def tagset
  @ole_obj.TagSetName
end

#tagset_nameObject



49
50
51
# File 'lib/microstation/tag.rb', line 49

def tagset_name
  @ole_obj.TagSetName
end

#to_sObject



37
38
39
# File 'lib/microstation/tag.rb', line 37

def to_s
  "#{value}"
end

#update_ole(value) ⇒ Object



53
54
55
56
# File 'lib/microstation/tag.rb', line 53

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

#valueObject



41
42
43
# File 'lib/microstation/tag.rb', line 41

def value
  @original
end

#write_ole(value) ⇒ Object



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

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