class Microstation::TS::Attribute

Constants

DefaultValue
IsConstant
IsHidden
Name
Prompt
RUBY_TO_MS
TYPES

msdTagTypeCharacter 1 (&H1) msdTagTypeShortInteger 2 (&H2) msdTagTypeLongInteger 3 (&H3) msdTagTypeDouble 4 (&H4) msdTagTypeBinary 5 (&H5)

Attributes

ole_obj[R]

Public Class Methods

new(ole, options = {}) click to toggle source
# File lib/microstation/ts/attribute.rb, line 48
def initialize(ole, options = {})
  @ole_obj = ole
  @definition = options[:definer]
end
tag_type(type) click to toggle source
# File lib/microstation/ts/attribute.rb, line 25
def self.tag_type(type)
  if type.class == Symbol
    ruby_type = case type
                when :char
                  String
                when :int
                  Integer
                when :float
                  Float
                else
                  :char
                end
  else
    ruby_type = type
  end

  RUBY_TO_MS[ruby_type]
end

Public Instance Methods

==(other) click to toggle source
# File lib/microstation/ts/attribute.rb, line 133
def ==(other)
  @ole_obj.Name == other.ole_obj.Name  && @ole_obj.TagSetName == other.ole_obj.TagSetName && @ole_obj.TagType == other.ole_obj.TagType
end
att_type() click to toggle source
# File lib/microstation/ts/attribute.rb, line 44
def att_type
  TYPES[type]
end
attrib_options() click to toggle source
# File lib/microstation/ts/attribute.rb, line 122
def attrib_options
  options = {}
  options[:default] = default_value if has_default?
  options[:readonly] = true if constant?
  options
end
close() click to toggle source
# File lib/microstation/ts/attribute.rb, line 53
def close
  @ole_obj = nil
end
constant=(constant) click to toggle source
# File lib/microstation/ts/attribute.rb, line 85
def constant=(constant)
  bool = constant ? true : false
  @ole_obj.IsConstant = bool
end
constant?() click to toggle source
# File lib/microstation/ts/attribute.rb, line 81
def constant?
  @ole_obj.IsConstant
end
default() click to toggle source
# File lib/microstation/ts/attribute.rb, line 90
def default
  @ole_obj.DefaultValue
end
default=(val) click to toggle source
# File lib/microstation/ts/attribute.rb, line 94
def default=(val)
  @ole_obj.DefaultValue = val
end
has_default?() click to toggle source
# File lib/microstation/ts/attribute.rb, line 98
def has_default?
  !!default
end
hidden=(hidden) click to toggle source
# File lib/microstation/ts/attribute.rb, line 106
def hidden=(hidden)
  bool =  hidden ? true :false
  @ole_obj.IsHidden = bool
end
hidden?() click to toggle source
# File lib/microstation/ts/attribute.rb, line 102
def hidden?
  @ole_obj.IsHidden
end
name() click to toggle source
# File lib/microstation/ts/attribute.rb, line 61
def name
  @ole_obj.name
end
name=(val) click to toggle source
# File lib/microstation/ts/attribute.rb, line 65
def name=(val)
  @ole_obj.Name = val
end
options_for_attribute() click to toggle source
# File lib/microstation/ts/attribute.rb, line 69
def options_for_attribute
  options = {}
  options[:is_hidden] = true if hidden?
  options[:prompt] = prompt if prompt
  options[:default] = default_value
  options[:readonly] = true if constant?
end
prompt() click to toggle source
# File lib/microstation/ts/attribute.rb, line 110
def prompt
  @ole_obj.Prompt
end
prompt=(val) click to toggle source
# File lib/microstation/ts/attribute.rb, line 114
def prompt=(val)
  @ole_obj.Prompt = val
end
tagset() click to toggle source
# File lib/microstation/ts/attribute.rb, line 57
def tagset
  @definition.tagset if definition
end
tagset_name() click to toggle source
# File lib/microstation/ts/attribute.rb, line 129
def tagset_name
  @ole_obj.TagSetName
end
to_s() click to toggle source
# File lib/microstation/ts/attribute.rb, line 77
def to_s
  "TagDefinition: #{name}"
end
type() click to toggle source
# File lib/microstation/ts/attribute.rb, line 118
def type
  TYPES[@ole_obj.TagType]
end