Class: Seedify::Logger
- Inherits:
-
Object
- Object
- Seedify::Logger
- Defined in:
- lib/seedify/logger.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Class Method Summary collapse
Instance Method Summary collapse
- #each(array, message, &block) ⇒ Object
-
#initialize(context) ⇒ Logger
constructor
A new instance of Logger.
- #line(message, &block) ⇒ Object
- #times(count, message, &block) ⇒ Object
Constructor Details
#initialize(context) ⇒ Logger
Returns a new instance of Logger.
15 16 17 |
# File 'lib/seedify/logger.rb', line 15 def initialize(context) @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
3 4 5 |
# File 'lib/seedify/logger.rb', line 3 def context @context end |
Class Method Details
.max_seed_name_length ⇒ Object
9 10 11 12 13 |
# File 'lib/seedify/logger.rb', line 9 def self.max_seed_name_length @max_seed_name_length ||= Seedify::Storage.seed_list.map do |name| seed_name_formatter(name).length end.max end |
.seed_name_formatter(name) ⇒ Object
5 6 7 |
# File 'lib/seedify/logger.rb', line 5 def self.seed_name_formatter(name) name.to_s.sub(/Seed$/, '') end |
Instance Method Details
#each(array, message, &block) ⇒ Object
25 26 27 |
# File 'lib/seedify/logger.rb', line 25 def each(array, , &block) process_items(array, array.length, , &block) end |
#line(message, &block) ⇒ Object
19 20 21 22 23 |
# File 'lib/seedify/logger.rb', line 19 def line(, &block) print "#{name} #{ }" yield if block_given? print "\n" end |
#times(count, message, &block) ⇒ Object
29 30 31 |
# File 'lib/seedify/logger.rb', line 29 def times(count, , &block) process_items(count.times.to_a, count, , &block) end |