Class: CSKit::Parsers::ScienceHealth::Positional
- Inherits:
-
Object
- Object
- CSKit::Parsers::ScienceHealth::Positional
- Defined in:
- lib/cskit/parsers/science_health/science_health_parser.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cardinality ⇒ Object
readonly
Returns the value of attribute cardinality.
-
#fragment ⇒ Object
readonly
Returns the value of attribute fragment.
Instance Method Summary collapse
-
#initialize(cardinality, fragment) ⇒ Positional
constructor
A new instance of Positional.
- #to_hash ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(cardinality, fragment) ⇒ Positional
52 53 54 55 |
# File 'lib/cskit/parsers/science_health/science_health_parser.rb', line 52 def initialize(cardinality, fragment) @cardinality = cardinality @fragment = fragment end |
Instance Attribute Details
#cardinality ⇒ Object (readonly)
Returns the value of attribute cardinality.
50 51 52 |
# File 'lib/cskit/parsers/science_health/science_health_parser.rb', line 50 def cardinality @cardinality end |
#fragment ⇒ Object (readonly)
Returns the value of attribute fragment.
50 51 52 |
# File 'lib/cskit/parsers/science_health/science_health_parser.rb', line 50 def fragment @fragment end |
Instance Method Details
#to_hash ⇒ Object
71 72 73 74 75 76 |
# File 'lib/cskit/parsers/science_health/science_health_parser.rb', line 71 def to_hash { cardinality: cardinality, fragment: fragment } end |
#to_s ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/cskit/parsers/science_health/science_health_parser.rb', line 57 def to_s card_s = case cardinality when 1 then '1st' when 2 then '2nd' when 3 then '3rd' end if cardinality "#{card_s} #{fragment}" else fragment end end |