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

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:



5
6
7
8
9
10
11
12
13
14
# File 'lib/flat_kit/input.rb', line 5

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

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

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

Instance Method Details

#closeObject

Raises:

  • (NotImplementedError)


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

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

#ioObject

Raises:

  • (NotImplementedError)


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

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

#nameObject

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/flat_kit/input.rb', line 16

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