Module: Output::Devices

Defined in:
lib/output/devices.rb

Defined Under Namespace

Modules: Builder, OptionValidation

Class Method Summary collapse

Class Method Details

.build_device(type, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/output/devices.rb', line 3

def self.build_device(type, options = {})
  builders = { 
    :stdout => Builder::Stdout,
    :string_io => Builder::StringIo,
    :file => Builder::File,
  }

  default_options = { :name => type, :pattern => DEFAULT_PATTERN }
  options = default_options.merge(options)
  name = options[:name]

  builder = builders[type]
  builder.build(name, options)
end