Sha256: f4f6e3df6918e26e3bc2857c157e8279bc2840bdf37a2a08db35bcfe271c27ad

Contents?: true

Size: 557 Bytes

Versions: 76

Compression:

Stored size: 557 Bytes

Contents

module Stud
  module With
    # Run a block with arguments. This is sometimes useful in lieu of
    # explicitly assigning variables.
    # 
    # I find mainly that using 'with' is a clue that I can factor out
    # a given segment of code into a method or function.
    #
    # Example usage:
    #
    #   with(TCPSocket.new("google.com", 80)) do |s|
    #     s.write("GET / HTTP/1.0\r\nHost: google.com\r\n\r\n")
    #     puts s.read
    #     s.close
    #   end
    def with(*args, &block)
      block.call(*args)
    end

    extend self
  end
end

Version data entries

76 entries across 72 versions & 18 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/with.rb