Sha256: c8f3fd73de98f05e72dd0c49d421cd51a16804a92b6e9181573485aea3aabd4c

Contents?: true

Size: 439 Bytes

Versions: 54

Compression:

Stored size: 439 Bytes

Contents

module Para
  module ModelFieldParsers
    class Enums < Para::ModelFieldParsers::Base
      register :enums, self

      def parse!
        model.defined_enums.each do |key, _|
          fields_hash[key] = AttributeField::EnumField.new(
            model, name: key, type: 'enum'
          )
        end
      end

      def applicable?
        model.respond_to?(:defined_enums) && !model.defined_enums.empty?
      end
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
para-0.12.4 lib/para/model_field_parsers/enums.rb
para-0.12.3 lib/para/model_field_parsers/enums.rb
para-0.12.2 lib/para/model_field_parsers/enums.rb
para-0.12.1 lib/para/model_field_parsers/enums.rb
para-0.12.0 lib/para/model_field_parsers/enums.rb
para-0.11.4 lib/para/model_field_parsers/enums.rb
para-0.11.3 lib/para/model_field_parsers/enums.rb
para-0.11.2 lib/para/model_field_parsers/enums.rb
para-0.11.1 lib/para/model_field_parsers/enums.rb
para-0.11.0 lib/para/model_field_parsers/enums.rb
para-0.10.0 lib/para/model_field_parsers/enums.rb
para-0.9.4 lib/para/model_field_parsers/enums.rb
para-0.9.3.3 lib/para/model_field_parsers/enums.rb
para-0.9.3.2 lib/para/model_field_parsers/enums.rb
para-0.9.3.1 lib/para/model_field_parsers/enums.rb
para-0.9.2 lib/para/model_field_parsers/enums.rb
para-0.9.0 lib/para/model_field_parsers/enums.rb
para-0.8.15 lib/para/model_field_parsers/enums.rb
para-0.8.14 lib/para/model_field_parsers/enums.rb
para-0.8.13 lib/para/model_field_parsers/enums.rb