Class: Relaton::Render::I18n
- Inherits:
-
Object
- Object
- Relaton::Render::I18n
- Defined in:
- lib/relaton/render/i18n/i18n.rb
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(opt) ⇒ I18n
constructor
attributes of the parsed Relaton object.
-
#select(obj) ⇒ Object
obj is the biblio hash, extracted by Relaton::Render::Fields There must always be a default selection, for obj = nil, being the document language setting.
- #select_default ⇒ Object
- #select_obj(_obj) ⇒ Object
Constructor Details
#initialize(opt) ⇒ I18n
attributes of the parsed Relaton object
6 7 8 9 10 11 12 13 14 |
# File 'lib/relaton/render/i18n/i18n.rb', line 6 def initialize(opt) if opt["i18n_multi"] @i18n = opt["i18n_multi"] elsif opt["i18n"] @i18n = { "" => opt["i18n"] } else raise error "Bad configuration, Relaton::Render::I18n" end end |
Instance Method Details
#config ⇒ Object
35 36 37 |
# File 'lib/relaton/render/i18n/i18n.rb', line 35 def config @i18n end |
#select(obj) ⇒ Object
obj is the biblio hash, extracted by Relaton::Render::Fields There must always be a default selection, for obj = nil, being the document language setting. If select is applied on obj, the i18n selected is appropriate to the citation specifically, and potentially to the field specificaly
21 22 23 24 25 |
# File 'lib/relaton/render/i18n/i18n.rb', line 21 def select(obj) if obj.nil? then select_default else select_obj(obj) end end |
#select_default ⇒ Object
27 28 29 |
# File 'lib/relaton/render/i18n/i18n.rb', line 27 def select_default @i18n[""] end |
#select_obj(_obj) ⇒ Object
31 32 33 |
# File 'lib/relaton/render/i18n/i18n.rb', line 31 def select_obj(_obj) @i18n[""] end |