Sha256: d6ce41f93752603a6d4480763b5008cd248e78a3b0b847c8e8bbce4d502b0d10

Contents?: true

Size: 577 Bytes

Versions: 4

Compression:

Stored size: 577 Bytes

Contents

module Administrate
  module Page
    class Base
      def initialize(dashboard)
        @dashboard = dashboard
      end

      def resource_name
        @resource_name ||=
          dashboard.class.to_s.scan(/(.+)Dashboard/).first.first.underscore
      end

      protected

      def attribute_field(dashboard, resource, attribute_name, page)
        value = resource.public_send(attribute_name)

        dashboard.
          field_class(attribute_name).
          new(attribute_name, value, page)
      end

      protected

      attr_reader :dashboard
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
administrate-0.0.6 lib/administrate/page/base.rb
administrate-0.0.4 lib/administrate/pages/base.rb
administrate-0.0.3 lib/administrate/pages/base.rb
administrate-0.0.2 lib/administrate/pages/base.rb