Class: Microstation::Definition

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

Overview

end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tagset) ⇒ Definition

Returns a new instance of Definition.



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

def initialize(tagset)
  @tagset = tagset
end

Instance Attribute Details

#tagsetObject (readonly)

Returns the value of attribute tagset.



165
166
167
# File 'lib/microstation/tag_set.rb', line 165

def tagset
  @tagset
end

Instance Method Details

#[](name) ⇒ Object



198
199
200
# File 'lib/microstation/tag_set.rb', line 198

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

#add_attribute(*args, **kwargs) {|td| ... } ⇒ Object

Yields:

  • (td)


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

def add_attribute(*args, **kwargs)
  td = create_attribute(*args, **kwargs)
  yield td if block_given?
  reset
  td
end

#attribute_namesObject



186
187
188
# File 'lib/microstation/tag_set.rb', line 186

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

#attributesObject

def definer

@definer ||= Definer.new(tagset)

end



182
183
184
# File 'lib/microstation/tag_set.rb', line 182

def attributes
  @attributes ||= init_definitions
end

#closeObject



194
195
196
# File 'lib/microstation/tag_set.rb', line 194

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

#resetObject



190
191
192
# File 'lib/microstation/tag_set.rb', line 190

def reset
  @attributes = nil
end