Sha256: bbdc87f7ce42c7730fd1d928ae1da838615e11f81be20d0a9e7e392d7482b974
Contents?: true
Size: 1.36 KB
Versions: 5
Compression:
Stored size: 1.36 KB
Contents
module Kernel private # like `cmd`, but with option support. # # @overload sh(cmd, o={}) # @param [String] cmd a shell command # @param [Symbol, Hash] o support {Array#extract_extend_options} # @option o [Boolean] :verbose print cmd if verbose # @return [String] result def sh cmd, *args o = args.extract_extend_options! puts cmd if o[:verbose] `#{cmd}` end alias original_system system # like Builtin system, but add option support # # @overload system(cmd, o={}) # @param [String] cmd # @param [Symbol, Hash] o support {Array#extract_extend_options} # @option o [Boolean] :verbose print cmd if verbose # @return [Boolean,nil] true false nil def system *cmds o = args.extract_extend_options! cmd = cmds.join(" ") puts cmd if o[:verbose] original_system cmd end # convert block to method. # # you can call a block with arguments # # @example USAGE # instance_eval(&blk) # blk2method(&blk).call *args # def blk2method &blk self.class.class_eval do define_method(:__blk2method, &blk) end method(:__blk2method) end # detect Platform information. # # RUBY_PLATFORM is "i686-linux" "i386-migw32" # # @return [Boolean] def linux?; RUBY_PLATFORM=~/linux/ end # detect PLatform information. # # @return [Boolean] # @see {#linux?} def win32?; RUBY_PLATFORM=~/mingw32|mswin/ end end # module Kernel
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
tagen-0.2.4 | lib/tagen/core/kernel.rb |
tagen-0.2.3 | lib/tagen/core/kernel.rb |
tagen-0.2.1 | lib/tagen/core/kernel.rb |
tagen-0.2.0 | lib/tagen/core/kernel.rb |
tagen-0.1.1 | lib/tagen/core/kernel.rb |