Sha256: ca4118d8c5008d4e10a96c2a0c8b9180350a53bbb873698cc1cf900afc107e9e

Contents?: true

Size: 564 Bytes

Versions: 1

Compression:

Stored size: 564 Bytes

Contents

require "forwardable"

module SuperTable
  class Record < Struct.new(:model)
    include ViewHelpers
    extend Forwardable

    class << self

      def property(attr_name)
        def_delegator :model, attr_name
      end
    end

    def helpers
      @helpers ||= Class.new do
        include ViewHelpers
      end.new
    end

    private

    def respond_to_missing?(name, include_private = false)
      model.respond_to?(name, include_private)
    end

    def method_missing(method, *args, &block)
      model.send(method, *args, &block)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
super_tools-3.0.1 lib/super_table/record.rb