Sha256: 80bb844a6558b25387d67cb535ba2059a22860c47fccdebff4eed9e3e481592a

Contents?: true

Size: 825 Bytes

Versions: 11

Compression:

Stored size: 825 Bytes

Contents

module Martyr
  module Level
    extend ActiveSupport::Concern

    included do
      attr_accessor :collection
    end

    def id
      "#{dimension_name}.#{name}"
    end

    # Used for reflection
    def level_object?
      true
    end

    def level_above
      @_level_above ||= collection.level_above(name)
    end

    def level_below
      @_level_below ||= collection.level_below(name)
    end

    def level_index
      @_level_index ||= collection.level_index(name)
    end
    alias_method :to_i, :level_index

    def query_level_below
      @_query_level_below ||= collection.query_level_below(name)
    end

    def level_and_above
      @_level_and_above ||= collection.level_and_above(name)
    end

    def level_and_below
      @_level_and_below ||= collection.level_and_below(name)
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
martyr-0.1.85.pre lib/martyr/level_concern/level.rb
martyr-0.1.84.pre lib/martyr/level_concern/level.rb
martyr-0.1.82.pre lib/martyr/level_concern/level.rb
martyr-0.1.81.pre lib/martyr/level_concern/level.rb
martyr-0.1.80.pre lib/martyr/level_concern/level.rb
martyr-0.1.79.pre lib/martyr/level_concern/level.rb
martyr-0.1.78.pre lib/martyr/level_concern/level.rb
martyr-0.1.77.pre lib/martyr/level_concern/level.rb
martyr-0.1.76.pre lib/martyr/level_concern/level.rb
martyr-0.1.75.pre lib/martyr/level_concern/level.rb
martyr-0.1.74.pre lib/martyr/level_concern/level.rb