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

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, inherited

Class Method Details

.from(out) ⇒ Object

Raises:



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

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

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

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

Instance Method Details

#closeObject

Raises:

  • (NotImplementedError)


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

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

#ioObject

Raises:

  • (NotImplementedError)


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

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

#nameObject

Raises:

  • (NotImplementedError)


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

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