Sha256: fdec531dd4414b444b4c97d50ead4b600549ba621b841634a6139764d832d389
Contents?: true
Size: 915 Bytes
Versions: 2
Compression:
Stored size: 915 Bytes
Contents
module L2meter class Configuration attr_writer :output attr_accessor :source attr_reader :contexts def initialize @contexts = [] end 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) @contexts = [block] end def context=(block_or_value) @contexts = [block_or_value] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
l2meter-0.0.4 | lib/l2meter/configuration.rb |
l2meter-0.0.3 | lib/l2meter/configuration.rb |