Class: Bookwatch::Config::SectionConfig
- Inherits:
-
Object
- Object
- Bookwatch::Config::SectionConfig
- Defined in:
- lib/bookwatch/config/section_config.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
- #at_repo_path ⇒ Object
- #dependent_sections ⇒ Object
- #desired_directory_name ⇒ Object
-
#initialize(config) ⇒ SectionConfig
constructor
A new instance of SectionConfig.
- #inspect ⇒ Object
- #merge(other_section_config) ⇒ Object
- #no_docs? ⇒ Boolean
- #pdf_output_filename ⇒ Object
- #preprocessor_config ⇒ Object
- #product_id ⇒ Object (also: #subnav_name)
- #product_info ⇒ Object
- #repo_name ⇒ Object
- #repo_ref ⇒ Object
- #repo_url ⇒ Object
- #subnav_template ⇒ Object
Constructor Details
#initialize(config) ⇒ SectionConfig
Returns a new instance of SectionConfig.
6 7 8 |
# File 'lib/bookwatch/config/section_config.rb', line 6 def initialize(config) @config = config end |
Instance Method Details
#==(other) ⇒ Object
56 57 58 |
# File 'lib/bookwatch/config/section_config.rb', line 56 def ==(other) config == other.instance_variable_get(:@config) end |
#at_repo_path ⇒ Object
38 39 40 |
# File 'lib/bookwatch/config/section_config.rb', line 38 def at_repo_path repo['at_path'] end |
#dependent_sections ⇒ Object
46 47 48 49 50 |
# File 'lib/bookwatch/config/section_config.rb', line 46 def dependent_sections @sections ||= (config['dependent_sections'] || []).map do |dep_section| SectionConfig.new(dep_section) end end |
#desired_directory_name ⇒ Object
18 19 20 |
# File 'lib/bookwatch/config/section_config.rb', line 18 def desired_directory_name config['directory'] end |
#inspect ⇒ Object
64 65 66 |
# File 'lib/bookwatch/config/section_config.rb', line 64 def inspect config.inspect end |
#merge(other_section_config) ⇒ Object
60 61 62 |
# File 'lib/bookwatch/config/section_config.rb', line 60 def merge(other_section_config) SectionConfig.new(config.merge(other_section_config.instance_variable_get(:@config))) end |
#no_docs? ⇒ Boolean
42 43 44 |
# File 'lib/bookwatch/config/section_config.rb', line 42 def no_docs? config.fetch('no_docs', false) end |
#pdf_output_filename ⇒ Object
22 23 24 |
# File 'lib/bookwatch/config/section_config.rb', line 22 def pdf_output_filename config['output_filename'] end |
#preprocessor_config ⇒ Object
52 53 54 |
# File 'lib/bookwatch/config/section_config.rb', line 52 def preprocessor_config config.fetch('preprocessor_config', {}) end |
#product_id ⇒ Object Also known as:
14 15 16 |
# File 'lib/bookwatch/config/section_config.rb', line 14 def product_id config['product_id'] end |
#product_info ⇒ Object
70 71 72 73 |
# File 'lib/bookwatch/config/section_config.rb', line 70 def product_info return {} if config['product_info'].nil? config['product_info'] end |
#repo_name ⇒ Object
26 27 28 |
# File 'lib/bookwatch/config/section_config.rb', line 26 def repo_name repo['name'] end |
#repo_ref ⇒ Object
34 35 36 |
# File 'lib/bookwatch/config/section_config.rb', line 34 def repo_ref repo['ref'] || 'master' end |
#repo_url ⇒ Object
30 31 32 |
# File 'lib/bookwatch/config/section_config.rb', line 30 def repo_url Ingest::RepoIdentifier.new(repo['name']) end |
#subnav_template ⇒ Object
10 11 12 |
# File 'lib/bookwatch/config/section_config.rb', line 10 def config['subnav_template'] end |