Sha256: 3b558ca4da68a593be2d70a0a53faa8fc1e32ae6e736ccd646493b37c2ca6af0
Contents?: true
Size: 931 Bytes
Versions: 2
Compression:
Stored size: 931 Bytes
Contents
module L2meter class Configuration attr_writer :output def output @output ||= $stdout end def key_formatter @key_formatter ||= ->(key) do key.to_s.strip.downcase.gsub(/[^-a-z\d]+/, ?-) end end def format_keys(&block) @key_formatter = block end def value_formatter @value_formatter ||= ->(value) do value = value.to_s value =~ /\s/ ? value.inspect : value end end def format_values(&block) @value_formatter = block end def sort? defined?(@apply_sort) ? @apply_sort : false end def sort=(value) @apply_sort = !!value end def context(&block) @context_block = block end def context=(value) @static_context = value end def get_context return @static_context if @static_context @context_block ? @context_block.call.to_h : {} end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
l2meter-0.0.2 | lib/l2meter/configuration.rb |
l2meter-0.0.1 | lib/l2meter/configuration.rb |