Sha256: 16feeb8f847bd2a16f0629c5d7467a7d40b860dc850ca04e55cc44dd177d5f18

Contents?: true

Size: 526 Bytes

Versions: 3

Compression:

Stored size: 526 Bytes

Contents

require 'active_support'
require 'enum_ish/version'
require 'enum_ish/builder'
require 'enum_ish/builder/active_record' if defined?(ActiveRecord::Base)

module EnumIsh
  def enum_ish(attr, enum, config = {})
    [:text, :options].each do |key|
      config[key] = true unless config.key?(key)
    end

    if defined?(ActiveRecord::Base) && self.ancestors.include?(ActiveRecord::Base)
      Builder::ActiveRecord.new(self).build(attr, enum, config)
    else
      Builder.new(self).build(attr, enum, config)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
enum_ish-1.1.1 lib/enum_ish.rb
enum_ish-1.1.0 lib/enum_ish.rb
enum_ish-1.0.0 lib/enum_ish.rb