Module: Output::ClassMethods

Defined in:
lib/output/output.rb

Instance Method Summary collapse

Instance Method Details

#default_device_typeObject



191
192
193
# File 'lib/output/output.rb', line 191

def default_device_type
  @device ||= ::Output::DEFAULT_DEVICE
end

#default_patternObject



183
184
185
# File 'lib/output/output.rb', line 183

def default_pattern
  @pattern ||= Output::DEFAULT_PATTERN
end

#device(device) ⇒ Object



195
196
197
# File 'lib/output/output.rb', line 195

def device(device)
  @device = device
end

#device_optionsObject



214
215
216
217
218
219
# File 'lib/output/output.rb', line 214

def device_options
  device_options = {}
  device_options[:device] = default_device_type
  device_options[:pattern] = default_pattern
  device_options
end

#logger_levelObject



199
200
201
# File 'lib/output/output.rb', line 199

def logger_level
  @logger_level ||= Output::DEFAULT_LOGGER_LEVEL
end

#logger_level=(level = nil) ⇒ Object Also known as: level



204
205
206
207
# File 'lib/output/output.rb', line 204

def logger_level=(level=nil)
  @logger_level = level unless level.nil?
  @logger_level
end

#pattern(format) ⇒ Object



187
188
189
# File 'lib/output/output.rb', line 187

def pattern(format)
  @pattern = format
end

#writer_attribute(name) ⇒ Object



231
232
233
# File 'lib/output/output.rb', line 231

def writer_attribute(name)
  Writer::Attribute.attribute_name(name)
end

#writer_macro(name, options = {}, &message_transformer) ⇒ Object Also known as: writer



221
222
223
224
225
226
227
# File 'lib/output/output.rb', line 221

def writer_macro(name, options = {}, &message_transformer)
  level = options[:level] || logger_level
  options = device_options.merge(options)

  WriterMacro.define_writer self, name, level, options,  message_transformer
  writer_names << name
end

#writer_namesObject



210
211
212
# File 'lib/output/output.rb', line 210

def writer_names
  @writer_names ||= []
end