Class: Microstation::Definition

Inherits:
Object
  • Object
show all
Defined in:
lib/microstation/tag_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tagset) ⇒ Definition

Returns a new instance of Definition.



129
130
131
# File 'lib/microstation/tag_set.rb', line 129

def initialize(tagset)
  @tagset = tagset
end

Instance Attribute Details

#tagsetObject (readonly)

Returns the value of attribute tagset.



127
128
129
# File 'lib/microstation/tag_set.rb', line 127

def tagset
  @tagset
end

Instance Method Details

#[](name) ⇒ Object



171
172
173
# File 'lib/microstation/tag_set.rb', line 171

def [](name)
  attributes.find{|d| d.name == name}
end

#add_attribute(name, type, options = {}) ⇒ Object



133
134
135
136
137
# File 'lib/microstation/tag_set.rb', line 133

def add_attribute(name,type,options={})
  td = definer.add_attribute(name,type,options)
  reset
  td
end

#attribute_namesObject



159
160
161
# File 'lib/microstation/tag_set.rb', line 159

def attribute_names
  attributes.map{|a| a.name}
end

#attributesObject



155
156
157
# File 'lib/microstation/tag_set.rb', line 155

def attributes
  @attributes ||= init_definitions
end

#closeObject



167
168
169
# File 'lib/microstation/tag_set.rb', line 167

def close
  attributes.each{| a| a.close}
end

#definerObject



139
140
141
# File 'lib/microstation/tag_set.rb', line 139

def definer
  @definer ||= Definer.new(tagset)
end

#init_definitionsObject



147
148
149
150
151
152
153
# File 'lib/microstation/tag_set.rb', line 147

def init_definitions
  results = []
  ole_tag_definitions.each do |ole|
    results << TS::Attribute.new(ole, {definer: self})
  end
  results
end

#ole_tag_definitionsObject



143
144
145
# File 'lib/microstation/tag_set.rb', line 143

def ole_tag_definitions
  tagset.ole_tag_definitions
end

#resetObject



163
164
165
# File 'lib/microstation/tag_set.rb', line 163

def reset
  @attributes = nil
end