Class: Pubid::Nist::Series
- Inherits:
-
Object
- Object
- Pubid::Nist::Series
- Defined in:
- lib/pubid/nist/series.rb
Instance Attribute Summary collapse
-
#parsed ⇒ Object
Returns the value of attribute parsed.
-
#series ⇒ Object
Returns the value of attribute series.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(series:, parsed: nil) ⇒ Series
constructor
A new instance of Series.
- #to_s(format = :short) ⇒ Object
Constructor Details
#initialize(series:, parsed: nil) ⇒ Series
Returns a new instance of Series.
7 8 9 10 11 12 |
# File 'lib/pubid/nist/series.rb', line 7 def initialize(series:, parsed: nil) raise Errors::SerieInvalidError, "#{series} is not valid series" unless SERIES["long"].key?(series) @series = series @parsed = parsed end |
Instance Attribute Details
#parsed ⇒ Object
Returns the value of attribute parsed.
5 6 7 |
# File 'lib/pubid/nist/series.rb', line 5 def parsed @parsed end |
#series ⇒ Object
Returns the value of attribute series.
5 6 7 |
# File 'lib/pubid/nist/series.rb', line 5 def series @series end |
Instance Method Details
#==(other) ⇒ Object
26 27 28 |
# File 'lib/pubid/nist/series.rb', line 26 def ==(other) other.series == @series end |
#to_s(format = :short) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/pubid/nist/series.rb', line 14 def to_s(format = :short) # return SERIES["abbrev"][@serie] || return @series if format == :short result = SERIES[format.to_s][@series] return @series if result.nil? && format == :mr return SERIES["long"][@series] if result.nil? result end |