Class: Microstation::Tag

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

Instance Attribute Summary collapse

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 Attribute Details

#base_elementObject



74
75
76
# File 'lib/microstation/tag.rb', line 74

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

Instance Method Details

#base_element_idObject



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/microstation/tag.rb', line 58

def base_element_id
  base = ole_base_element
  id = begin
    base.Id || base.ID64
  rescue
    nil
  end
  if id.instance_of?(WIN32OLE_RECORD)
    return id.Low if id.Low > id.High

    return id.High

  end
  id
end

#inspectObject



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

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

#nameObject



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

def name
  @ole_obj.TagDefinitionName
end

#ole_base_elementObject



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

def ole_base_element
  @ole_obj.BaseElement
end

#ole_valueObject



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

def ole_value
  @ole_obj.Value
end

#read_ole(ole) ⇒ Object

def initialize(ole)

@ole_obj = ole
@original = @ole_obj.Value

end



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

def read_ole(ole)
  ole.Value
end

#tagsetObject



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

def tagset
  @ole_obj.TagSetName
end

#tagset_nameObject



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

def tagset_name
  @ole_obj.TagSetName
end

#to_sObject



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

def to_s
  "#{value}"
end

#update_ole(value) ⇒ Object



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

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

#valueObject



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

def value
  @original
end

#write_ole(value) ⇒ Object



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

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