Sha256: 52eded4d9d5a40f1ea304e75a4c3313fdc6b3f1fb04776bfa0421613123b3749

Contents?: true

Size: 550 Bytes

Versions: 1

Compression:

Stored size: 550 Bytes

Contents

module HyperAdmin
  module DSL
    class Show

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

      def row(attribute, type: infer_type(attribute), human: human_name(attribute))
        @rows << { 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/show.rb