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
Returns a new instance of Positional.
48 49 50 51 |
# File 'lib/cskit/parsers/science_health/science_health_parser.rb', line 48 def initialize(cardinality, fragment) @cardinality = cardinality @fragment = fragment end |
Instance Attribute Details
#cardinality ⇒ Object (readonly)
Returns the value of attribute cardinality.
46 47 48 |
# File 'lib/cskit/parsers/science_health/science_health_parser.rb', line 46 def cardinality @cardinality end |
#fragment ⇒ Object (readonly)
Returns the value of attribute fragment.
46 47 48 |
# File 'lib/cskit/parsers/science_health/science_health_parser.rb', line 46 def fragment @fragment end |
Instance Method Details
#to_hash ⇒ Object
67 68 69 70 71 72 |
# File 'lib/cskit/parsers/science_health/science_health_parser.rb', line 67 def to_hash { cardinality: cardinality, fragment: fragment } end |
#to_s ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/cskit/parsers/science_health/science_health_parser.rb', line 53 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 |