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
31 32 33 34 |
# File 'lib/pandocomatic/input.rb', line 31 def initialize(input) @input_files = input @errors = [] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
26 27 28 |
# File 'lib/pandocomatic/input.rb', line 26 def errors @errors end |
Instance Method Details
#absolute_path ⇒ Object
The absolute path to this Input
39 40 41 |
# File 'lib/pandocomatic/input.rb', line 39 def absolute_path File.absolute_path @input_files.first end |
#base ⇒ Object
The base name of this Input
46 47 48 |
# File 'lib/pandocomatic/input.rb', line 46 def base File.basename @input_files.first end |
#directory? ⇒ Boolean
Is this input a directory?
60 61 62 |
# File 'lib/pandocomatic/input.rb', line 60 def directory? File.directory? @input_files.first end |
#errors? ⇒ Boolean
Does this input have encountered any errors?
67 68 69 |
# File 'lib/pandocomatic/input.rb', line 67 def errors? !@errors.empty? end |
#name ⇒ Object
The name of this input
53 54 55 |
# File 'lib/pandocomatic/input.rb', line 53 def name @input_files.first end |
#to_s ⇒ Object
A string representation of this Input
74 75 76 |
# File 'lib/pandocomatic/input.rb', line 74 def to_s name end |