Sha256: d864399322a18d266175d9fe1f285f641022910e4550ceb039d37c0d8853f79a

Contents?: true

Size: 718 Bytes

Versions: 11

Compression:

Stored size: 718 Bytes

Contents

module Liquid
  class ResourceLimits
    attr_accessor :render_length, :render_score, :assign_score,
      :render_length_limit, :render_score_limit, :assign_score_limit

    def initialize(limits)
      @render_length_limit = limits[:render_length_limit]
      @render_score_limit = limits[:render_score_limit]
      @assign_score_limit = limits[:assign_score_limit]
      reset
    end

    def reached?
      (@render_length_limit && @render_length > @render_length_limit) ||
        (@render_score_limit && @render_score > @render_score_limit) ||
        (@assign_score_limit && @assign_score > @assign_score_limit)
    end

    def reset
      @render_length = @render_score = @assign_score = 0
    end
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
liquid-4.0.4 lib/liquid/resource_limits.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/liquid-4.0.3/lib/liquid/resource_limits.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/liquid-4.0.3/lib/liquid/resource_limits.rb
liquid-4.0.3 lib/liquid/resource_limits.rb
liquid-4.0.2 lib/liquid/resource_limits.rb
liquid-4-0-2-4.0.2 lib/liquid/resource_limits.rb
liquid-4.0.1 lib/liquid/resource_limits.rb
liquid-4.0.0 lib/liquid/resource_limits.rb
liquid-4.0.0.rc3 lib/liquid/resource_limits.rb
liquid-4.0.0.rc2 lib/liquid/resource_limits.rb
liquid-4.0.0.rc1 lib/liquid/resource_limits.rb