Sha256: c1713766a6f52a25873cf40321f336e967b55f5338ce6375c188468d44eb4d98
Contents?: true
Size: 849 Bytes
Versions: 1
Compression:
Stored size: 849 Bytes
Contents
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) ## This example shows different ways of accessing the `.with_spinner` method. require 'cli_spinnable' # 1. Use `CliSpinnable.with_spinner` directly. CliSpinnable.with_spinner do |cli| cli.print 'Downloading something' sleep 1 cli.tick end # 2. Create own module and extend it with CliSpinnable. # This way you will have own namespace for `.with_spinner` method. module Foo extend CliSpinnable end Foo.with_spinner do |cli| cli.print 'Downloading something' sleep 1 cli.tick end # 3. Include CliSpinnable module in own class. # This way you can access `with_spinner` method within that class. class Bar include CliSpinnable def call with_spinner do |cli| cli.print 'Downloading something' sleep 1 cli.tick end end end Bar.new.call
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cli_spinnable-0.2 | examples/example1.rb |