Class: Pubid::Components::Edition
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Pubid::Components::Edition
- Defined in:
- lib/pubid/components/edition.rb
Overview
Edition component (typically a year and number)
Instance Method Summary collapse
-
#original_format ⇒ Object
Method to get the original parsed format if needed.
- #render(context: nil) ⇒ Object
- #to_s ⇒ Object
-
#value ⇒ Object
V1 API compatibility - tests expect .value on edition itself.
Instance Method Details
#original_format ⇒ Object
Method to get the original parsed format if needed
27 28 29 |
# File 'lib/pubid/components/edition.rb', line 27 def original_format original_text end |
#render(context: nil) ⇒ Object
22 23 24 |
# File 'lib/pubid/components/edition.rb', line 22 def render(context: nil) to_s end |
#to_s ⇒ Object
11 12 13 14 15 |
# File 'lib/pubid/components/edition.rb', line 11 def to_s # Always use canonical format for rendering number_value = number.is_a?(Components::Code) ? number.value : number number_value ? "ED#{number_value}" : nil end |
#value ⇒ Object
V1 API compatibility - tests expect .value on edition itself
18 19 20 |
# File 'lib/pubid/components/edition.rb', line 18 def value number.is_a?(Components::Code) ? number.value : number end |