Class: RelatonBib::ICS
Instance Attribute Summary collapse
- #code ⇒ String readonly
- #text ⇒ String readonly
Instance Method Summary collapse
-
#initialize(code:, text:) ⇒ ICS
constructor
A new instance of ICS.
- #to_asciibib(prefix = "", count = 1) ⇒ String
- #to_hash ⇒ Hash
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(code:, text:) ⇒ ICS
Returns a new instance of ICS.
8 9 10 11 |
# File 'lib/relaton_bib/ics.rb', line 8 def initialize(code:, text:) @code = code @text = text end |
Instance Attribute Details
#code ⇒ String (readonly)
4 5 6 |
# File 'lib/relaton_bib/ics.rb', line 4 def code @code end |
#text ⇒ String (readonly)
4 5 6 |
# File 'lib/relaton_bib/ics.rb', line 4 def text @text end |
Instance Method Details
#to_asciibib(prefix = "", count = 1) ⇒ String
29 30 31 32 33 34 35 |
# File 'lib/relaton_bib/ics.rb', line 29 def to_asciibib(prefix = "", count = 1) pref = prefix.empty? ? "ics" : prefix + ".ics" out = count > 1 ? "#{pref}::\n" : "" out += "#{pref}.code:: #{code}\n" out += "#{pref}.text:: #{text}\n" out end |
#to_hash ⇒ Hash
22 23 24 |
# File 'lib/relaton_bib/ics.rb', line 22 def to_hash { "code" => code, "text" => text } end |
#to_xml(builder) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/relaton_bib/ics.rb', line 14 def to_xml(builder) builder.ics do |b| b.code code b.text_ text end end |