Class: MARC4J4R::SubField
- Inherits:
-
Object
- Object
- MARC4J4R::SubField
- Defined in:
- lib/marc4j4r/datafield.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
- #code ⇒ Object
- #code=(str) ⇒ Object
-
#initialize(code = nil, data = nil) ⇒ SubField
constructor
A new instance of SubField.
- #oldinit ⇒ Object
- #to_s ⇒ Object
- #value ⇒ Object
- #value=(str) ⇒ Object
Constructor Details
#initialize(code = nil, data = nil) ⇒ SubField
Returns a new instance of SubField.
158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/marc4j4r/datafield.rb', line 158 def initialize code=nil, data=nil if code code = code[0].ord if data self.oldinit(code, data) else self.oldinit(code) end else self.oldinit end end |
Instance Method Details
#==(other) ⇒ Object
171 172 173 |
# File 'lib/marc4j4r/datafield.rb', line 171 def == other return ((self.code == other.code) and (self.data == other.data)) end |
#code ⇒ Object
183 184 185 |
# File 'lib/marc4j4r/datafield.rb', line 183 def code return self.getCode.chr end |
#code=(str) ⇒ Object
187 188 189 |
# File 'lib/marc4j4r/datafield.rb', line 187 def code= str self.setCode str[0].ord end |
#oldinit ⇒ Object
157 |
# File 'lib/marc4j4r/datafield.rb', line 157 alias_method :oldinit, :initialize |
#to_s ⇒ Object
191 192 193 |
# File 'lib/marc4j4r/datafield.rb', line 191 def to_s return '$' + self.code + " " + self.data end |
#value ⇒ Object
175 176 177 |
# File 'lib/marc4j4r/datafield.rb', line 175 def value return self.data end |
#value=(str) ⇒ Object
179 180 181 |
# File 'lib/marc4j4r/datafield.rb', line 179 def value= str self.data = str end |