Class: Rumbrl::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/rumbrl/factory.rb

Overview

an insanely dumb logger creator broken regulations & underaged workers abound

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nm, path: nil, age: nil, size: nil, level: nil) ⇒ Factory

Returns a new instance of Factory.



15
16
17
18
19
20
21
22
23
24
# File 'lib/rumbrl/factory.rb', line 15

def initialize(nm, path: nil, age: nil, size: nil, level: nil)
  @name = nm
  @log_format = Env.log_format
  @data_format = Env.data_format
  @time_format = Env.time_format
  @size ||= (size || Env.shift_size)
  @age ||= (age || Env.shift_age)
  @level ||= (level || ::Logger::INFO)
  @dest = log_dest path, nm
end

Instance Attribute Details

#ageObject

Returns the value of attribute age.



9
10
11
# File 'lib/rumbrl/factory.rb', line 9

def age
  @age
end

#data_formatObject

Returns the value of attribute data_format.



9
10
11
# File 'lib/rumbrl/factory.rb', line 9

def data_format
  @data_format
end

#destObject (readonly)

Returns the value of attribute dest.



8
9
10
# File 'lib/rumbrl/factory.rb', line 8

def dest
  @dest
end

#levelObject

Returns the value of attribute level.



9
10
11
# File 'lib/rumbrl/factory.rb', line 9

def level
  @level
end

#log_formatObject

Returns the value of attribute log_format.



9
10
11
# File 'lib/rumbrl/factory.rb', line 9

def log_format
  @log_format
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/rumbrl/factory.rb', line 8

def name
  @name
end

#sizeObject

Returns the value of attribute size.



9
10
11
# File 'lib/rumbrl/factory.rb', line 9

def size
  @size
end

#time_formatObject

Returns the value of attribute time_format.



9
10
11
# File 'lib/rumbrl/factory.rb', line 9

def time_format
  @time_format
end

Class Method Details

.create(nm, path: nil, age: nil, size: nil, level: nil) ⇒ Object



11
12
13
# File 'lib/rumbrl/factory.rb', line 11

def self.create(nm, path: nil, age: nil, size: nil, level: nil)
  new(nm, path: path, age: age, size: size, level: level).generate
end

Instance Method Details

#generateObject



26
27
28
29
# File 'lib/rumbrl/factory.rb', line 26

def generate
  init_path dest
  generate_logger
end