Module: Output::ClassMethods

Defined in:
lib/output/output.rb

Instance Method Summary collapse

Instance Method Details

#default_device_typeObject



193
194
195
# File 'lib/output/output.rb', line 193

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

#default_patternObject



185
186
187
# File 'lib/output/output.rb', line 185

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

#device(device) ⇒ Object



197
198
199
# File 'lib/output/output.rb', line 197

def device(device)
  @device = device
end

#device_optionsObject



216
217
218
219
220
221
# File 'lib/output/output.rb', line 216

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

#logger_levelObject



201
202
203
# File 'lib/output/output.rb', line 201

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

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



206
207
208
209
# File 'lib/output/output.rb', line 206

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

#pattern(format) ⇒ Object



189
190
191
# File 'lib/output/output.rb', line 189

def pattern(format)
  @pattern = format
end

#writer_attribute(name) ⇒ Object



234
235
236
# File 'lib/output/output.rb', line 234

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

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



224
225
226
227
228
229
230
# File 'lib/output/output.rb', line 224

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



212
213
214
# File 'lib/output/output.rb', line 212

def writer_names
  @writer_names ||= []
end