Sha256: 455bd17422ce9977bbf0fd5167f7fa3b7a1a569a5bcb4204272816b702e29144

Contents?: true

Size: 656 Bytes

Versions: 5

Compression:

Stored size: 656 Bytes

Contents

module Ecm
  module Courses
    module Configuration
      def configure
        yield self
      end

      mattr_accessor(:base_controller) { '::ApplicationController' }

      mattr_accessor(:show_free_places) { false }

      mattr_accessor(:free_seats_level_proc) do
        lambda do |course|
          {
            0..9    => { color: 'red' },
            10..69  => { color: 'yellow' },
            70..100 => { color: 'green' }
          }
        end
      end

      def self.free_seats_level_for(course)
        free_seats_level_proc.call(course).select { |percentage| percentage === course.free_seats_percentage }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ecm_courses2-1.1.4 lib/ecm/courses/configuration.rb
ecm_courses2-1.1.3 lib/ecm/courses/configuration.rb
ecm_courses2-1.1.2 lib/ecm/courses/configuration.rb
ecm_courses2-1.1.1 lib/ecm/courses/configuration.rb
ecm_courses2-1.1.0 lib/ecm/courses/configuration.rb