Class: LCCallNumber::Cutter
- Inherits:
-
Object
- Object
- LCCallNumber::Cutter
- 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
-
#digits ⇒ Object
Returns the value of attribute digits.
-
#dot ⇒ Object
Returns the value of attribute dot.
-
#letter ⇒ Object
Returns the value of attribute letter.
Instance Method Summary collapse
-
#initialize(l, d, dot = nil) ⇒ Cutter
constructor
A new instance of Cutter.
- #inspect ⇒ Object
- #to_s ⇒ Object
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
#digits ⇒ Object
Returns the value of attribute digits.
103 104 105 |
# File 'lib/lc_callnumber/lcc.rb', line 103 def digits @digits end |
#dot ⇒ Object
Returns the value of attribute dot.
103 104 105 |
# File 'lib/lc_callnumber/lcc.rb', line 103 def dot @dot end |
#letter ⇒ Object
Returns the value of attribute letter.
103 104 105 |
# File 'lib/lc_callnumber/lcc.rb', line 103 def letter @letter end |
Instance Method Details
#inspect ⇒ Object
110 111 112 |
# File 'lib/lc_callnumber/lcc.rb', line 110 def inspect "Cut<#{letter},#{digits}>" end |
#to_s ⇒ Object
114 115 116 |
# File 'lib/lc_callnumber/lcc.rb', line 114 def to_s "#{letter}#{digits}" end |