Class: CSKit::Parsers::Bible::Positional

Inherits:
Struct
  • Object
show all
Defined in:
lib/cskit/parsers/bible/bible_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cardinalityObject

Returns the value of attribute cardinality

Returns:

  • (Object)

    the current value of cardinality



58
59
60
# File 'lib/cskit/parsers/bible/bible_parser.rb', line 58

def cardinality
  @cardinality
end

#fragmentObject

Returns the value of attribute fragment

Returns:

  • (Object)

    the current value of fragment



58
59
60
# File 'lib/cskit/parsers/bible/bible_parser.rb', line 58

def fragment
  @fragment
end

Instance Method Details

#to_hashObject



73
74
75
76
77
78
# File 'lib/cskit/parsers/bible/bible_parser.rb', line 73

def to_hash
  {
    cardinality: cardinality,
    fragment: fragment
  }
end

#to_sObject



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/cskit/parsers/bible/bible_parser.rb', line 59

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