Class: Bindery::Book

Inherits:
Object
  • Object
show all
Defined in:
lib/bindery/book.rb

Defined Under Namespace

Classes: DublinMetadata, Metadata

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#authorObject

Returns the value of attribute author.



9
10
11
# File 'lib/bindery/book.rb', line 9

def author
  @author
end

#isbnObject

Returns the value of attribute isbn.



9
10
11
# File 'lib/bindery/book.rb', line 9

def isbn
  @isbn
end

#languageObject

Returns the value of attribute language.



9
10
11
# File 'lib/bindery/book.rb', line 9

def language
  @language
end

#outputObject

Returns the value of attribute output.



9
10
11
# File 'lib/bindery/book.rb', line 9

def output
  @output
end

#subtitleObject

Returns the value of attribute subtitle.



9
10
11
# File 'lib/bindery/book.rb', line 9

def subtitle
  @subtitle
end

#titleObject

Returns the value of attribute title.



9
10
11
# File 'lib/bindery/book.rb', line 9

def title
  @title
end

#urlObject

Returns the value of attribute url.



9
10
11
# File 'lib/bindery/book.rb', line 9

def url
  @url
end

Instance Method Details

#configuration_valid?Boolean

Returns:

  • (Boolean)


31
32
33
34
35
36
# File 'lib/bindery/book.rb', line 31

def configuration_valid?
  true
  # formats specified or correctly defaulted
  # ouput specified
  # at least one division
end

#divisionsObject



19
20
21
# File 'lib/bindery/book.rb', line 19

def divisions
  @divisions ||= []
end

#divisions_valid?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/bindery/book.rb', line 44

def divisions_valid?
  divisions.all?{|div| div.valid?} # && division file names are unique
end

#formatsObject



15
16
17
# File 'lib/bindery/book.rb', line 15

def formats
  @formats ||= []
end

#full_titleObject



23
24
25
# File 'lib/bindery/book.rb', line 23

def full_title
  title + (subtitle ? ": #{subtitle}" : '')
end

#generateObject



48
49
50
51
52
53
# File 'lib/bindery/book.rb', line 48

def generate
  formats.each do |format|
    require "bindery/formats/#{format}"
    ::Bindery::Formats.const_get(format.to_s.capitalize).new(self).generate
  end
end

#metadataObject



11
12
13
# File 'lib/bindery/book.rb', line 11

def 
  @metadata ||= []
end

#metadata_valid?Boolean

Returns:

  • (Boolean)


38
39
40
41
42
# File 'lib/bindery/book.rb', line 38

def 
  true
  # everything required has been specified (must find out what that is)
  # what is there is correct
end

#valid?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/bindery/book.rb', line 27

def valid?
  configuration_valid? &&  && divisions_valid?
end