Sha256: e74013b5660eefe06b95e2a1ee0c420f3d585e36b43bdc5a1df1718bc11fc893
Contents?: true
Size: 802 Bytes
Versions: 7
Compression:
Stored size: 802 Bytes
Contents
def set_common_options c c.option '-i', '--interval SECONDS', Integer, 'Interval in seconds in which to listen for an event.' c.option '-t', '--timeout SECONDS', Integer, 'Timeout after n seconds.' c.option '-r', '--require LIBS', Array, 'Require ruby libraries.' c.option '-V', '--verbose', 'Log information to STDOUT.' end def listener options Bind::Listener.new options_to_hash(options) end def populate_common_options options options.require.each { |lib| require lib } if options.require options.debug = $stdout if options.verbose end def expand_path path path.include?('://') ? path : File.expand_path(path) end def options_to_hash options options.singleton_methods.inject({}) do |hash, meth| hash[meth.to_sym] = options.send meth unless meth =~ /=$/ hash end end
Version data entries
7 entries across 7 versions & 1 rubygems