Class: Microstation::Drawing::Number

Inherits:
Object
  • Object
show all
Defined in:
lib/microstation/extensions/faa.rb,
lib/microstation/extensions/faa.rb

Constant Summary collapse

DRAWING_RE =
/(.+)-.+-(.+)-(.+).dgn/

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(locid, factype, index) ⇒ Number

Returns a new instance of Number.



32
33
34
35
36
# File 'lib/microstation/extensions/faa.rb', line 32

def initialize(locid, factype, index)
  @locid = locid.to_s.upcase
  @factype = factype.to_s.upcase
  @index = Index(index)
end

Instance Attribute Details

#factypeObject (readonly)

Returns the value of attribute factype.



30
31
32
# File 'lib/microstation/extensions/faa.rb', line 30

def factype
  @factype
end

#indexObject (readonly)

Returns the value of attribute index.



30
31
32
# File 'lib/microstation/extensions/faa.rb', line 30

def index
  @index
end

#locidObject (readonly)

Returns the value of attribute locid.



30
31
32
# File 'lib/microstation/extensions/faa.rb', line 30

def locid
  @locid
end

Class Method Details

.from_string(drawing_name) ⇒ Object



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

def self.from_string(drawing_name)
  md = DRAWING_RE.match(drawing_name.to_s)
  new(md[1], md[2], md[3])
end

Instance Method Details

#+(other) ⇒ Object



46
47
48
# File 'lib/microstation/extensions/faa.rb', line 46

def +(other)
  self.class.new(locid, factype, index.+(other))
end

#-(other) ⇒ Object



50
51
52
# File 'lib/microstation/extensions/faa.rb', line 50

def -(other)
  self.class.new(locid, factype, index.-(other))
end

#disciplineObject



42
43
44
# File 'lib/microstation/extensions/faa.rb', line 42

def discipline
  index.discipline
end

#Index(str) ⇒ Object



23
24
25
26
# File 'lib/microstation/extensions/faa.rb', line 23

def Index(str)
  return str if str == Drawing::Index
  Drawing::Index.new(str.to_s)
end

#to_sObject



38
39
40
# File 'lib/microstation/extensions/faa.rb', line 38

def to_s
  [locid, "D", factype, index.to_s].join("-")
end