Class: LCCallNumber::Cutter

Inherits:
Object
  • Object
show all
Defined in:
lib/lc_callnumber/lcc.rb

Overview

A “Cutter” is a single letter followed by one or more digits It is sometimes preceded by a decimal point. We note whether or not we got a decimal point because it may be a hint as to whether or not we’re actually looking at a Cutter.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(l, d, dot = nil) ⇒ Cutter

Returns a new instance of Cutter.



104
105
106
107
108
# File 'lib/lc_callnumber/lcc.rb', line 104

def initialize(l,d, dot=nil)
  @letter = l.to_s
  @digits = d.to_i
  @dot = !dot.nil?
end

Instance Attribute Details

#digitsObject

Returns the value of attribute digits.



103
104
105
# File 'lib/lc_callnumber/lcc.rb', line 103

def digits
  @digits
end

#dotObject

Returns the value of attribute dot.



103
104
105
# File 'lib/lc_callnumber/lcc.rb', line 103

def dot
  @dot
end

#letterObject

Returns the value of attribute letter.



103
104
105
# File 'lib/lc_callnumber/lcc.rb', line 103

def letter
  @letter
end

Instance Method Details

#inspectObject



110
111
112
# File 'lib/lc_callnumber/lcc.rb', line 110

def inspect
  "Cut<#{letter},#{digits}>"
end

#to_sObject



114
115
116
# File 'lib/lc_callnumber/lcc.rb', line 114

def to_s
  "#{letter}#{digits}"
end