Class: FlatKit::Input

Inherits:
Object
  • Object
show all
Extended by:
DescendantTracker
Defined in:
lib/flat_kit/input.rb,
lib/flat_kit/input/io.rb,
lib/flat_kit/input/file.rb

Overview

Internal: Base class of all input handlers

Direct Known Subclasses

File, IO

Defined Under Namespace

Classes: File, IO

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DescendantTracker

children, find_child, find_children, inherited

Class Method Details

.from(input) ⇒ Object

Raises:



9
10
11
12
13
14
15
16
# File 'lib/flat_kit/input.rb', line 9

def self.from(input)
  return input if input.is_a?(::FlatKit::Input)

  in_klass = find_child(:handles?, input)
  return in_klass.new(input) if in_klass

  raise FlatKit::Error, "Unable to create input from #{input.class} : #{input.inspect}"
end

Instance Method Details

#closeObject

Raises:

  • (NotImplementedError)


26
27
28
# File 'lib/flat_kit/input.rb', line 26

def close
  raise NotImplementedError, "#{self.class} must implement #close"
end

#ioObject

Raises:

  • (NotImplementedError)


22
23
24
# File 'lib/flat_kit/input.rb', line 22

def io
  raise NotImplementedError, "#{self.class} must implement #io"
end

#nameObject

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/flat_kit/input.rb', line 18

def name
  raise NotImplementedError, "#{self.class} must implement #name"
end