Sha256: ea17e706dd3d1c3d6ffc342eb09d61fd0327e8846898056fe6dee46ec11c6d58

Contents?: true

Size: 408 Bytes

Versions: 1

Compression:

Stored size: 408 Bytes

Contents

require 'active_support/concern'

module Journey::Resource::EnumSets
  extend ActiveSupport::Concern

  included do
    def self.enum_set(attr, collection=[])
      collection_const_name = attr.to_s.pluralize.upcase.to_sym
      const_set collection_const_name, collection.freeze      
      define_method "#{attr}_values" do
        self.class.const_get(collection_const_name)
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
embark-journey-0.0.13 lib/journey/resource/enum_sets.rb