Class: M2H::Base
- Inherits:
-
Object
- Object
- M2H::Base
- Defined in:
- lib/m2h/base.rb
Instance Attribute Summary collapse
-
#cover ⇒ Object
readonly
Returns the value of attribute cover.
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#serif ⇒ Object
readonly
Returns the value of attribute serif.
-
#sys_enc ⇒ Object
readonly
Returns the value of attribute sys_enc.
-
#toc ⇒ Object
readonly
Returns the value of attribute toc.
Instance Method Summary collapse
-
#initialize(argv, option) ⇒ Base
constructor
A new instance of Base.
- #path_inspect(files) ⇒ Object
Constructor Details
#initialize(argv, option) ⇒ Base
Returns a new instance of Base.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/m2h/base.rb', line 5 def initialize(argv, option) @errors = [] @files = path_inspect(argv) @sys_enc = Encoding.locale_charmap @serif = option[:serif] ? true : false @header = option[:header] ? true : false @cover = option[:cover] ? true : false @toc = option[:toc] ? true : false if @errors.empty? return self else @errors.each do |e| puts e end exit 3 end end |
Instance Attribute Details
#cover ⇒ Object (readonly)
Returns the value of attribute cover.
3 4 5 |
# File 'lib/m2h/base.rb', line 3 def cover @cover end |
#files ⇒ Object (readonly)
Returns the value of attribute files.
3 4 5 |
# File 'lib/m2h/base.rb', line 3 def files @files end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
3 4 5 |
# File 'lib/m2h/base.rb', line 3 def header @header end |
#serif ⇒ Object (readonly)
Returns the value of attribute serif.
3 4 5 |
# File 'lib/m2h/base.rb', line 3 def serif @serif end |
#sys_enc ⇒ Object (readonly)
Returns the value of attribute sys_enc.
3 4 5 |
# File 'lib/m2h/base.rb', line 3 def sys_enc @sys_enc end |
#toc ⇒ Object (readonly)
Returns the value of attribute toc.
3 4 5 |
# File 'lib/m2h/base.rb', line 3 def toc @toc end |
Instance Method Details
#path_inspect(files) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/m2h/base.rb', line 23 def path_inspect(files) is_valid = true = [] files.each { |f| unless File.exists?(File.(f)) is_valid = false @errors.push("PathError: Could not found #{f}") else .push(File.(f)) end } return end |