Sha256: 3f7206be69e04a8771ea403a987fa6a2ae78e402f89925a35c4fa8221d100c17
Contents?: true
Size: 997 Bytes
Versions: 3
Compression:
Stored size: 997 Bytes
Contents
module L2meter class Configuration attr_writer :output attr_accessor :source, :prefix attr_reader :context, :key_formatter, :value_formatter, :output DEFAULT_KEY_FORMATTER = ->(key) do key.to_s.strip.downcase.gsub(/[^-a-z\d.#]+/, ?-) end DEFAULT_VALUE_FORMATTER = ->(value) do value = value.to_s value =~ /\s/ ? value.inspect : value end private_constant :DEFAULT_KEY_FORMATTER, :DEFAULT_VALUE_FORMATTER def initialize @sort = false @key_formatter = DEFAULT_KEY_FORMATTER @value_formatter = DEFAULT_VALUE_FORMATTER @output = $stdout end def format_keys(&block) @key_formatter = block end def format_values(&block) @value_formatter = block end def sort? @sort end def sort=(value) @sort = !!value end def context if block_given? @context = Proc.new else @context end end attr_writer :context end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
l2meter-0.5.0 | lib/l2meter/configuration.rb |
l2meter-0.4.1 | lib/l2meter/configuration.rb |
l2meter-0.4.0 | lib/l2meter/configuration.rb |