Class: Reading::Row::SourcesSubattribute
- Defined in:
- lib/reading/attribute/variants/sources_subattribute.rb
Instance Method Summary collapse
-
#initialize(bare_variant:, config:) ⇒ SourcesSubattribute
constructor
A new instance of SourcesSubattribute.
- #parse ⇒ Object
Constructor Details
#initialize(bare_variant:, config:) ⇒ SourcesSubattribute
Returns a new instance of SourcesSubattribute.
11 12 13 14 |
# File 'lib/reading/attribute/variants/sources_subattribute.rb', line 11 def initialize(bare_variant:, config:) = @config = config end |
Instance Method Details
#parse ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/reading/attribute/variants/sources_subattribute.rb', line 16 def parse urls = sources_urls().map { |url| { name: url_name(url) || template.deep_fetch(:sources, 0, :name), url: url, } } names = sources_names().map { |name| { name: name, url: template.deep_fetch(:sources, 0, :url), } } (urls + names).presence end |