Sha256: 928fb1030e46db2814e3effddb68a28e749db72ca82b44d9c2b8ac999c7d0125

Contents?: true

Size: 603 Bytes

Versions: 31

Compression:

Stored size: 603 Bytes

Contents

module Recruiter
  module ShowHelper
    def show_for(model, &block)
      if block_given?
        yield AttributeShower.new(model, self)
      end
    end

    class AttributeShower
      attr_reader :object, :helper

      def initialize(object, helper)
        @object = object
        @helper = helper
      end

      def show(attribute)
        render(
          object.class.human_attribute_name(attribute),
          object.send(attribute)
        )
      end

      def render(label, value)
        helper.render('application/show_item', label: label, value: value)
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
recruiter-1.1.18 app/helpers/recruiter/show_helper.rb
recruiter-1.1.17 app/helpers/recruiter/show_helper.rb
recruiter-1.1.16 app/helpers/recruiter/show_helper.rb
recruiter-1.1.15 app/helpers/recruiter/show_helper.rb
recruiter-1.1.14 app/helpers/recruiter/show_helper.rb
recruiter-1.1.12 app/helpers/recruiter/show_helper.rb
recruiter-1.1.11 app/helpers/recruiter/show_helper.rb
recruiter-1.1.10 app/helpers/recruiter/show_helper.rb
recruiter-1.1.9 app/helpers/recruiter/show_helper.rb
recruiter-1.1.8 app/helpers/recruiter/show_helper.rb
recruiter-1.1.7 app/helpers/recruiter/show_helper.rb
recruiter-1.1.6 app/helpers/recruiter/show_helper.rb
recruiter-1.1.5 app/helpers/recruiter/show_helper.rb
recruiter-1.1.4 app/helpers/recruiter/show_helper.rb
recruiter-1.1.3 app/helpers/recruiter/show_helper.rb
recruiter-1.1.2 app/helpers/recruiter/show_helper.rb
recruiter-1.1.1 app/helpers/recruiter/show_helper.rb
recruiter-1.1.0 app/helpers/recruiter/show_helper.rb
recruiter-1.0.0 app/helpers/recruiter/show_helper.rb
recruiter-0.1.5 app/helpers/recruiter/show_helper.rb