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.



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

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.



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

def factype
  @factype
end

#indexObject (readonly)

Returns the value of attribute index.



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

def index
  @index
end

#locidObject (readonly)

Returns the value of attribute locid.



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

def locid
  @locid
end

Class Method Details

.from_string(drawing_name) ⇒ Object



25
26
27
28
# File 'lib/microstation/extensions/faa.rb', line 25

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

#+(n) ⇒ Object



56
57
58
# File 'lib/microstation/extensions/faa.rb', line 56

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

#-(n) ⇒ Object



60
61
62
# File 'lib/microstation/extensions/faa.rb', line 60

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

#disciplineObject



52
53
54
# File 'lib/microstation/extensions/faa.rb', line 52

def discipline
  index.discipline
end

#Index(str) ⇒ Object



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

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

#to_sObject



48
49
50
# File 'lib/microstation/extensions/faa.rb', line 48

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