Class: Xpub::CallBook

Inherits:
Object
  • Object
show all
Defined in:
lib/xpub/dsl/book.rb,
lib/xpub/dsl/page.rb,
lib/xpub/dsl/builder.rb,
lib/xpub/dsl/checker.rb,
lib/xpub/dsl/src_file.rb

Defined Under Namespace

Classes: CallAuthor, CallBuilder, CallChecker, CallEpubBuilder, CallIdentifier, CallImgFile, CallImgFiles, CallKanaChecker, CallLatexBuilder, CallMdFile, CallMdFiles, CallNumberChecker, CallSrcFile

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ CallBook

Returns a new instance of CallBook.



18
19
20
21
22
23
24
25
26
27
# File 'lib/xpub/dsl/book.rb', line 18

def initialize(name)
  @name = name
  @creators = []
  @contributors = []
  @identifiers = []
  @src_files = []
  @resource_files = []
  @builders = []
  @checkers = []
end

Instance Attribute Details

#contributorsObject (readonly)

Returns the value of attribute contributors.



3
4
5
# File 'lib/xpub/dsl/book.rb', line 3

def contributors
  @contributors
end

#creatorsObject (readonly)

Returns the value of attribute creators.



3
4
5
# File 'lib/xpub/dsl/book.rb', line 3

def creators
  @creators
end

#identifiersObject (readonly)

Returns the value of attribute identifiers.



3
4
5
# File 'lib/xpub/dsl/book.rb', line 3

def identifiers
  @identifiers
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/xpub/dsl/book.rb', line 3

def name
  @name
end

#resource_filesObject (readonly)

Returns the value of attribute resource_files.



3
4
5
# File 'lib/xpub/dsl/book.rb', line 3

def resource_files
  @resource_files
end

#src_filesObject (readonly)

Returns the value of attribute src_files.



3
4
5
# File 'lib/xpub/dsl/book.rb', line 3

def src_files
  @src_files
end

Instance Method Details

#build(option) ⇒ Object



32
33
34
35
36
37
# File 'lib/xpub/dsl/book.rb', line 32

def build(option)
  puts "build #{@name} book.".color :green
  @builders.each do |b|
    b.build option if !option[:builder] || option[:builder] == b.name
  end
end

#check(option) ⇒ Object



39
40
41
42
43
44
# File 'lib/xpub/dsl/book.rb', line 39

def check(option)
  puts "check #{@name} book.".color :green
  @checkers.each do |c|
    c.check option if !option[:checker] || option[:checker] == c.name
  end
end

#contributor(name, &block) ⇒ Object



65
66
67
68
69
70
# File 'lib/xpub/dsl/book.rb', line 65

def contributor(name, &block)
  call = CallAuthor.new name
  call.instance_eval(&block) if block
  call.validate
  @contributors << call
end

#creator(name, &block) ⇒ Object



58
59
60
61
62
63
# File 'lib/xpub/dsl/book.rb', line 58

def creator(name, &block)
  call = CallAuthor.new name
  call.instance_eval(&block) if block
  call.validate
  @creators << call
end

#epub_builder(name, &block) ⇒ Object



305
306
307
308
309
310
# File 'lib/xpub/dsl/builder.rb', line 305

def epub_builder(name, &block)
  call = CallEpubBuilder.new name, self
  call.instance_eval(&block) if block
  call.validate
  @builders << call
end

#identifier(identifier, &block) ⇒ Object



85
86
87
88
89
90
# File 'lib/xpub/dsl/book.rb', line 85

def identifier(identifier, &block)
  call = CallIdentifier.new identifier
  call.instance_eval(&block) if block
  call.validate
  @identifiers << call
end

#img_file(file, &block) ⇒ Object



105
106
107
108
109
110
# File 'lib/xpub/dsl/src_file.rb', line 105

def img_file(file, &block)
  call = CallImgFile.new file
  call.instance_eval(&block) if block
  call.validate
  @resource_files << call
end

#img_files(dir, &block) ⇒ Object



112
113
114
115
116
117
# File 'lib/xpub/dsl/src_file.rb', line 112

def img_files(dir, &block)
  call = CallImgFiles.new dir
  call.instance_eval(&block) if block
  call.validate
  @resource_files.concat call.img_files
end

#kana_checker(name, &block) ⇒ Object



58
59
60
61
62
63
# File 'lib/xpub/dsl/checker.rb', line 58

def kana_checker(name, &block)
  call = CallKanaChecker.new name, self
  call.instance_eval(&block) if block
  call.validate
  @checkers << call
end

#latex_builder(name, &block) ⇒ Object



312
313
314
315
316
317
# File 'lib/xpub/dsl/builder.rb', line 312

def latex_builder(name, &block)
  call = CallLatexBuilder.new name, self
  call.instance_eval(&block) if block
  call.validate
  @builders << call
end

#md_file(file, &block) ⇒ Object



91
92
93
94
95
96
# File 'lib/xpub/dsl/src_file.rb', line 91

def md_file(file, &block)
  call = CallMdFile.new file
  call.instance_eval(&block) if block
  call.validate
  @src_files << call
end

#md_files(dir, &block) ⇒ Object



98
99
100
101
102
103
# File 'lib/xpub/dsl/src_file.rb', line 98

def md_files(dir, &block)
  call = CallMdFiles.new dir
  call.instance_eval(&block) if block
  call.validate
  @src_files.concat call.md_files
end

#number_checker(name, &block) ⇒ Object



51
52
53
54
55
56
# File 'lib/xpub/dsl/checker.rb', line 51

def number_checker(name, &block)
  call = CallNumberChecker.new name, self
  call.instance_eval(&block) if block
  call.validate
  @checkers << call
end

#validateObject



29
30
# File 'lib/xpub/dsl/book.rb', line 29

def validate
end