Sha256: 3c0eb8b42f970b0a21824c301823ca97e27d27664a4a6ae6a330ea7f42106c70

Contents?: true

Size: 393 Bytes

Versions: 17

Compression:

Stored size: 393 Bytes

Contents

# frozen_string_literal: true

module Grape
  module Util
    class LazyBlock
      def initialize(&new_block)
        @block = new_block
      end

      def evaluate_from(configuration)
        @block.call(configuration)
      end

      def evaluate
        @block.call({})
      end

      def lazy?
        true
      end

      def to_s
        evaluate.to_s
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
grape-2.0.0 lib/grape/util/lazy_block.rb
grape-1.8.0 lib/grape/util/lazy_block.rb
grape-1.7.1 lib/grape/util/lazy_block.rb
grape-1.7.0 lib/grape/util/lazy_block.rb
grape-1.6.2 lib/grape/util/lazy_block.rb
grape-1.6.1 lib/grape/util/lazy_block.rb
grape-1.6.0 lib/grape/util/lazy_block.rb
grape-1.5.3 lib/grape/util/lazy_block.rb
grape-1.5.2 lib/grape/util/lazy_block.rb
grape-1.5.1 lib/grape/util/lazy_block.rb
grape-1.5.0 lib/grape/util/lazy_block.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/grape-1.4.0/lib/grape/util/lazy_block.rb
grape-1.4.0 lib/grape/util/lazy_block.rb
grape-1.3.3 lib/grape/util/lazy_block.rb
grape-1.3.2 lib/grape/util/lazy_block.rb
grape-1.3.1 lib/grape/util/lazy_block.rb
grape-1.3.0 lib/grape/util/lazy_block.rb