Sha256: fdeab757ea772027e3d4776e9c55e2eac5943357cbcf5dffbf5ad3cb596427d4

Contents?: true

Size: 595 Bytes

Versions: 1

Compression:

Stored size: 595 Bytes

Contents

module ReportsKit
  module Reports
    class Filter
      attr_accessor :properties

      def initialize(properties)
        properties = { key: properties } if properties.is_a?(String)
        raise ArgumentError.new("Filter properties must be a String or Hash, not a #{properties.class.name}: #{properties.inspect}") unless properties.is_a?(Hash)
        self.properties = properties.deep_symbolize_keys
      end

      def key
        properties[:key]
      end

      def label
        key.titleize
      end

      def normalized_properties
        properties
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reports_kit-0.2.0 lib/reports_kit/reports/filter.rb