Sha256: 166c2d8b74b70adb1e1375c517c26eacfc925d835db6b2d2b83190a0012dd1ad

Contents?: true

Size: 666 Bytes

Versions: 9

Compression:

Stored size: 666 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 expression
        properties[:expression] || key
      end

      def label
        key.titleize
      end

      def normalized_properties
        properties
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
reports_kit-0.7.1 lib/reports_kit/reports/filter.rb
reports_kit-0.7.0 lib/reports_kit/reports/filter.rb
reports_kit-0.5.0 lib/reports_kit/reports/filter.rb
reports_kit-0.4.1 lib/reports_kit/reports/filter.rb
reports_kit-0.4.0 lib/reports_kit/reports/filter.rb
reports_kit-0.3.3 lib/reports_kit/reports/filter.rb
reports_kit-0.3.2 lib/reports_kit/reports/filter.rb
reports_kit-0.3.1 lib/reports_kit/reports/filter.rb
reports_kit-0.3.0 lib/reports_kit/reports/filter.rb