Class: Bookwatch::Section

Inherits:
Struct
  • Object
show all
Defined in:
lib/bookwatch/values/section.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#at_repo_pathObject

Returns the value of attribute at_repo_path

Returns:

  • (Object)

    the current value of at_repo_path



5
6
7
# File 'lib/bookwatch/values/section.rb', line 5

def at_repo_path
  @at_repo_path
end

#desired_directory_nameObject

Returns the value of attribute desired_directory_name

Returns:

  • (Object)

    the current value of desired_directory_name



5
6
7
# File 'lib/bookwatch/values/section.rb', line 5

def desired_directory_name
  @desired_directory_name
end

#desired_subnav_nameObject

Returns the value of attribute desired_subnav_name

Returns:

  • (Object)

    the current value of desired_subnav_name



5
6
7
# File 'lib/bookwatch/values/section.rb', line 5

def desired_subnav_name
  @desired_subnav_name
end

#full_nameObject

Returns the value of attribute full_name

Returns:

  • (Object)

    the current value of full_name



5
6
7
# File 'lib/bookwatch/values/section.rb', line 5

def full_name
  @full_name
end

#path_to_repository=(value) ⇒ Object

Sets the attribute path_to_repository

Parameters:

  • value (Object)

    the value to set the attribute path_to_repository to.

Returns:

  • (Object)

    the newly set value



5
6
7
# File 'lib/bookwatch/values/section.rb', line 5

def path_to_repository=(value)
  @path_to_repository = value
end

#pdf_output_filenameObject

Returns the value of attribute pdf_output_filename

Returns:

  • (Object)

    the current value of pdf_output_filename



5
6
7
# File 'lib/bookwatch/values/section.rb', line 5

def pdf_output_filename
  @pdf_output_filename
end

#preprocessor_configObject

Returns the value of attribute preprocessor_config

Returns:

  • (Object)

    the current value of preprocessor_config



5
6
7
# File 'lib/bookwatch/values/section.rb', line 5

def preprocessor_config
  @preprocessor_config
end

#product_infoObject

Returns the value of attribute product_info

Returns:

  • (Object)

    the current value of product_info



5
6
7
# File 'lib/bookwatch/values/section.rb', line 5

def product_info
  @product_info
end

#repo_nameObject

Returns the value of attribute repo_name

Returns:

  • (Object)

    the current value of repo_name



5
6
7
# File 'lib/bookwatch/values/section.rb', line 5

def repo_name
  @repo_name
end

#source_refObject

Returns the value of attribute source_ref

Returns:

  • (Object)

    the current value of source_ref



5
6
7
# File 'lib/bookwatch/values/section.rb', line 5

def source_ref
  @source_ref
end

Returns the value of attribute subnav_templ

Returns:

  • (Object)

    the current value of subnav_templ



5
6
7
# File 'lib/bookwatch/values/section.rb', line 5

def subnav_templ
  @subnav_templ
end

Instance Method Details

#destination_directoryObject



26
27
28
# File 'lib/bookwatch/values/section.rb', line 26

def destination_directory
  Ingest::DestinationDirectory.new(full_name, desired_directory_name)
end

#namespaceObject



34
35
36
# File 'lib/bookwatch/values/section.rb', line 34

def namespace
  destination_directory.to_s.gsub(%r{[./]}, '_')
end

#path_to_preprocessor_attribute(attr) ⇒ Object



42
43
44
45
46
47
48
49
# File 'lib/bookwatch/values/section.rb', line 42

def path_to_preprocessor_attribute(attr)
  path_to_repo_dir.join(preprocessor_config[attr]) if preprocessor_config[attr]
rescue NoMethodError => e
  raise Errors::ProgrammerMistake.new(
    "path_to_preprocessor_attribute assumes preprocessor_config is available, got nil.\n" +
      "Original exception:\n\n#{e.inspect}\n\n#{e.backtrace.join("\n")}"
  )
end

#path_to_repo_dirObject



18
19
20
# File 'lib/bookwatch/values/section.rb', line 18

def path_to_repo_dir
  at_repo_path.nil? ? path_to_repository : path_to_repository.join(at_repo_path)
end


30
31
32
# File 'lib/bookwatch/values/section.rb', line 30

def subnav
  {namespace => subnav_name}
end


38
39
40
# File 'lib/bookwatch/values/section.rb', line 38

def subnav_name
  subnav_template || desired_subnav_name || 'default'
end


22
23
24
# File 'lib/bookwatch/values/section.rb', line 22

def subnav_template
  subnav_templ.sub(/^_/, '').sub(/\.erb$/, '') if subnav_templ
end