Sha256: 6c107729fcb1d9436bb7f9272e55adc001a6693878a6ff7ed10b4ec34a622dcd

Contents?: true

Size: 773 Bytes

Versions: 3

Compression:

Stored size: 773 Bytes

Contents

module Groupdate
  class Series
    attr_accessor :magic, :relation

    def initialize(magic, relation)
      @magic = magic
      @relation = relation
      @calculations = Groupdate::Calculations.new(relation)
    end

    # clone to prevent modifying original variables
    def method_missing(method, *args, &block)
      if @calculations.include?(method)
        magic.perform(relation, method, *args, &block)
      elsif relation.respond_to?(method, true)
        Groupdate::Series.new(magic, relation.send(method, *args, &block))
      else
        super
      end
    end

    def respond_to?(method, include_all = false)
      @calculations.include?(method) || relation.respond_to?(method) || super
    end

    def reverse_order_value
      nil
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
groupdate-3.2.0 lib/groupdate/series.rb
groupdate-3.1.1 lib/groupdate/series.rb
groupdate-3.1.0 lib/groupdate/series.rb