Class: FlatKit::Input::File
- Inherits:
-
FlatKit::Input
- Object
- FlatKit::Input
- FlatKit::Input::File
- Defined in:
- lib/flat_kit/input/file.rb
Overview
Internal: Handler for file based input
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#io ⇒ Object
readonly
Returns the value of attribute io.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(obj) ⇒ File
constructor
A new instance of File.
- #name ⇒ Object
Methods inherited from FlatKit::Input
Methods included from DescendantTracker
#children, #find_child, #find_children, #inherited
Constructor Details
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
11 12 13 |
# File 'lib/flat_kit/input/file.rb', line 11 def count @count end |
#io ⇒ Object (readonly)
Returns the value of attribute io.
11 12 13 |
# File 'lib/flat_kit/input/file.rb', line 11 def io @io end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
11 12 13 |
# File 'lib/flat_kit/input/file.rb', line 11 def path @path end |
Class Method Details
.handles?(obj) ⇒ Boolean
13 14 15 16 17 18 19 20 21 |
# File 'lib/flat_kit/input/file.rb', line 13 def self.handles?(obj) return true if obj.instance_of?(Pathname) return false unless obj.instance_of?(String) # incase these get loaded in different orders return false if ::FlatKit::Input::IO.stdin?(obj) true end |
Instance Method Details
#close ⇒ Object
36 37 38 |
# File 'lib/flat_kit/input/file.rb', line 36 def close @io.close end |
#name ⇒ Object
32 33 34 |
# File 'lib/flat_kit/input/file.rb', line 32 def name path.to_s end |