Class: RelatonIsoBib::TypedTitleString
- Inherits:
-
RelatonBib::TypedTitleString
- Object
- RelatonBib::TypedTitleString
- RelatonIsoBib::TypedTitleString
- Defined in:
- lib/relaton_iso_bib/typed_title_string.rb
Constant Summary collapse
- TITLE_TYPES =
%w[title-main title-intro title-part main].freeze
Instance Method Summary collapse
-
#initialize(**args) ⇒ TypedTitleString
constructor
A new instance of TypedTitleString.
Constructor Details
#initialize(**args) ⇒ TypedTitleString
Returns a new instance of TypedTitleString.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/relaton_iso_bib/typed_title_string.rb', line 12 def initialize(**args) if args[:type] && !TITLE_TYPES.include?(args[:type]) raise ArgumentError, %{The type #{args[:type]} is invalid.} end unless args[:title] || args[:content] raise ArgumentError, %{Keyword "title" or "content" should be passed.} end @type = args[:type] if args[:title] @title = args[:title] else fsargs = args.select { |k, _v| i[content language script format].include? k } @title = RelatonBib::FormattedString.new(fsargs) end end |