Class: FlatKit::Output

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

Overview

Internal: Base clases for all output 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(out) ⇒ Object

Raises:



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

def self.from(out)
  return out if out.is_a?(::FlatKit::Output)

  out_klass = find_child(:handles?, out)
  return out_klass.new(out) if out_klass

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

Instance Method Details

#closeObject

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/flat_kit/output.rb', line 30

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

#ioObject

Raises:

  • (NotImplementedError)


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

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

#nameObject

Raises:

  • (NotImplementedError)


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

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

#tellObject



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

def tell
  io.tell
end