Sha256: 22792ce5c59c3635a8b8d8b7f9e22a5bfbcdba2801acddf505fb5b22d5dca0a2

Contents?: true

Size: 472 Bytes

Versions: 8

Compression:

Stored size: 472 Bytes

Contents

require 'rails_admin/config/model'

module RailsAdmin
  module Config
    class LazyModel
      def initialize(entity, &block)
        @entity = entity
        @deferred_block = block
      end

      def method_missing(method, *args, &block)
        if !@model
          @model = RailsAdmin::Config::Model.new(@entity)
          @model.instance_eval(&@deferred_block) if @deferred_block
        end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rails_admin-0.6.0 lib/rails_admin/config/lazy_model.rb
rails_admin-0.5.0 lib/rails_admin/config/lazy_model.rb
rails_admin-0.4.9 lib/rails_admin/config/lazy_model.rb
rails_admin-0.4.8 lib/rails_admin/config/lazy_model.rb
rails_admin-0.4.7 lib/rails_admin/config/lazy_model.rb
rails_admin-0.4.6 lib/rails_admin/config/lazy_model.rb
rails_admin-0.4.5 lib/rails_admin/config/lazy_model.rb
rails_admin-0.4.4 lib/rails_admin/config/lazy_model.rb