Sha256: 2ef485d85584437f0f99a4becc7ca10026d42c5eca9658469d8084856178bc76

Contents?: true

Size: 560 Bytes

Versions: 1

Compression:

Stored size: 560 Bytes

Contents

module HyperAdmin
  module DSL
    class Index

      def initialize(resource_class)
        @resource_class = resource_class
        @columns = []
      end

      def column(attribute, type: infer_type(attribute), human: human_name(attribute))
        @columns << { attribute: attribute, type: type, human: human }
      end

      private

      def infer_type(attribute)
        @resource_class.columns_hash[attribute.to_s].type
      end

      def human_name(attribute)
        @resource_class.human_attribute_name attribute
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hyper_admin-0.4.0 lib/hyper_admin/dsl/index.rb