Class: Elibri::ONIX::Release_3_0::Language
- Inherits:
-
Object
- Object
- Elibri::ONIX::Release_3_0::Language
- Includes:
- Inspector
- Defined in:
- lib/elibri_onix/onix_3_0/language.rb
Constant Summary collapse
- ATTRIBUTES =
:nodoc:
[ :role, :code, :role_name, :language ]
- RELATIONS =
:nodoc:
[ :inspect_include_fields ]
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
kod języka, np.
-
#role ⇒ Object
readonly
:doc: kod onix roli, np.
-
#to_xml ⇒ Object
readonly
reprezentacja w xml.
Instance Method Summary collapse
- #eid ⇒ Object
- #id ⇒ Object
-
#initialize(data) ⇒ Language
constructor
A new instance of Language.
- #inspect_include_fields ⇒ Object
-
#language ⇒ Object
język, np.
-
#role_name ⇒ Object
określenie roli jako string, np.
Methods included from Inspector
#attribute_for_inspect, #inspect
Constructor Details
#initialize(data) ⇒ Language
Returns a new instance of Language.
37 38 39 40 41 |
# File 'lib/elibri_onix/onix_3_0/language.rb', line 37 def initialize(data) @to_xml = data.to_s @role = data.at_xpath('xmlns:LanguageRole').try(:text) @code = data.at_xpath('xmlns:LanguageCode').try(:text) end |
Instance Attribute Details
#code ⇒ Object (readonly)
kod języka, np. ‘pol’ pełna lista kodów: github.com/elibri/elibri_onix_dict/blob/master/lib/elibri_onix_dict/onix_3_0/serialized/LanguageCode.yml
32 33 34 |
# File 'lib/elibri_onix/onix_3_0/language.rb', line 32 def code @code end |
#role ⇒ Object (readonly)
:doc:
kod onix roli, np. ‘01’ pełna lista ról: github.com/elibri/elibri_onix_dict/blob/master/lib/elibri_onix_dict/onix_3_0/serialized/LanguageRole.yml
28 29 30 |
# File 'lib/elibri_onix/onix_3_0/language.rb', line 28 def role @role end |
#to_xml ⇒ Object (readonly)
reprezentacja w xml
35 36 37 |
# File 'lib/elibri_onix/onix_3_0/language.rb', line 35 def to_xml @to_xml end |
Instance Method Details
#eid ⇒ Object
57 58 59 |
# File 'lib/elibri_onix/onix_3_0/language.rb', line 57 def eid "#{@role}-#{@code}" end |
#id ⇒ Object
61 62 63 64 |
# File 'lib/elibri_onix/onix_3_0/language.rb', line 61 def id Kernel.warn "[DEPRECATION] `id` is deprecated. Please use `eid` instead." eid end |
#inspect_include_fields ⇒ Object
53 54 55 |
# File 'lib/elibri_onix/onix_3_0/language.rb', line 53 def inspect_include_fields [:role_name, :language] end |