Sha256: 9fac97d251c3c5f7bb49cc7916cc22cf12a6383ae9745569dcd15f23da65e2df

Contents?: true

Size: 447 Bytes

Versions: 5

Compression:

Stored size: 447 Bytes

Contents

# frozen_string_literal: true

module Grape
  module Util
    module Lazy
      class Block
        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
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
grape-2.2.0 lib/grape/util/lazy/block.rb
grape-2.1.3 lib/grape/util/lazy/block.rb
grape-2.1.2 lib/grape/util/lazy/block.rb
grape-2.1.1 lib/grape/util/lazy/block.rb
grape-2.1.0 lib/grape/util/lazy/block.rb