Class: ArgumentsHelper
- Inherits:
-
Object
- Object
- ArgumentsHelper
- Defined in:
- lib/rspec_n/helpers/arguments_helper.rb
Class Method Summary collapse
- .arguments ⇒ Object
-
.no_options_in_arguments? ⇒ Boolean
Read arguments from the config file only if no arguments are provided by user.
-
.read_options_from_file ⇒ Object
Options can be listed on a single line in the config file, or listed on separate lines.
Class Method Details
.arguments ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/rspec_n/helpers/arguments_helper.rb', line 5 def arguments if File.exist?(".rspec_n") && = if .any? print "Reading options from `.rspec_n` file\n" return ARGV + end end ARGV end |
.no_options_in_arguments? ⇒ Boolean
Read arguments from the config file only if no arguments are provided by user
17 18 19 |
# File 'lib/rspec_n/helpers/arguments_helper.rb', line 17 def ARGV.grep(/^-/).empty? # Match args that start with - (or --). Those are the options. end |
.read_options_from_file ⇒ Object
Options can be listed on a single line in the config file, or listed on separate lines.
22 23 24 |
# File 'lib/rspec_n/helpers/arguments_helper.rb', line 22 def Shellwords.shellwords File.read(".rspec_n").to_s.gsub(/\n|\r\n/, " ") end |