Class: Pandocomatic::Input
- Inherits:
-
Object
- Object
- Pandocomatic::Input
- Defined in:
- lib/pandocomatic/input.rb
Overview
Generic class to handle input files and directories in a general manner.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#absolute_path ⇒ Object
The absolute path to this Input.
-
#base ⇒ Object
The base name of this Input.
-
#directory? ⇒ Boolean
Is this input a directory?.
-
#errors? ⇒ Boolean
Does this input have encountered any errors?.
-
#initialize(input) ⇒ Input
constructor
Create a new Input.
-
#name ⇒ Object
The name of this input.
-
#to_s ⇒ Object
A string representation of this Input.
Constructor Details
#initialize(input) ⇒ Input
Create a new Input
29 30 31 32 |
# File 'lib/pandocomatic/input.rb', line 29 def initialize(input) @input_files = input @errors = [] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
24 25 26 |
# File 'lib/pandocomatic/input.rb', line 24 def errors @errors end |
Instance Method Details
#absolute_path ⇒ Object
The absolute path to this Input
37 38 39 |
# File 'lib/pandocomatic/input.rb', line 37 def absolute_path File.absolute_path @input_files.first end |
#base ⇒ Object
The base name of this Input
44 45 46 |
# File 'lib/pandocomatic/input.rb', line 44 def base File.basename @input_files.first end |
#directory? ⇒ Boolean
Is this input a directory?
58 59 60 |
# File 'lib/pandocomatic/input.rb', line 58 def directory? File.directory? @input_files.first end |
#errors? ⇒ Boolean
Does this input have encountered any errors?
65 66 67 |
# File 'lib/pandocomatic/input.rb', line 65 def errors? !@errors.empty? end |
#name ⇒ Object
The name of this input
51 52 53 |
# File 'lib/pandocomatic/input.rb', line 51 def name @input_files.first end |
#to_s ⇒ Object
A string representation of this Input
72 73 74 |
# File 'lib/pandocomatic/input.rb', line 72 def to_s name end |