Class: SeeingIsBelieving::Binary
- Inherits:
-
Object
- Object
- SeeingIsBelieving::Binary
- Defined in:
- lib/seeing_is_believing/binary.rb,
lib/seeing_is_believing/binary/arg_parser.rb,
lib/seeing_is_believing/binary/line_formatter.rb,
lib/seeing_is_believing/binary/print_results_next_to_lines.rb
Defined Under Namespace
Classes: ArgParser, LineFormatter, PrintResultsNextToLines
Instance Attribute Summary collapse
-
#argv ⇒ Object
Returns the value of attribute argv.
-
#stderr ⇒ Object
Returns the value of attribute stderr.
-
#stdin ⇒ Object
Returns the value of attribute stdin.
-
#stdout ⇒ Object
Returns the value of attribute stdout.
Instance Method Summary collapse
- #call ⇒ Object (also: #exitstatus)
-
#initialize(argv, stdin, stdout, stderr) ⇒ Binary
constructor
A new instance of Binary.
Constructor Details
#initialize(argv, stdin, stdout, stderr) ⇒ Binary
Returns a new instance of Binary.
10 11 12 13 14 15 |
# File 'lib/seeing_is_believing/binary.rb', line 10 def initialize(argv, stdin, stdout, stderr) self.argv = argv self.stdin = stdin self.stdout = stdout self.stderr = stderr end |
Instance Attribute Details
#argv ⇒ Object
Returns the value of attribute argv.
8 9 10 |
# File 'lib/seeing_is_believing/binary.rb', line 8 def argv @argv end |
#stderr ⇒ Object
Returns the value of attribute stderr.
8 9 10 |
# File 'lib/seeing_is_believing/binary.rb', line 8 def stderr @stderr end |
#stdin ⇒ Object
Returns the value of attribute stdin.
8 9 10 |
# File 'lib/seeing_is_believing/binary.rb', line 8 def stdin @stdin end |
#stdout ⇒ Object
Returns the value of attribute stdout.
8 9 10 |
# File 'lib/seeing_is_believing/binary.rb', line 8 def stdout @stdout end |
Instance Method Details
#call ⇒ Object Also known as: exitstatus
17 18 19 20 21 22 23 24 25 |
# File 'lib/seeing_is_believing/binary.rb', line 17 def call @exitstatus ||= if flags_have_errors? then print_errors ; 1 elsif should_print_help? then print_help ; 0 elsif has_filename? && file_dne? then print_file_dne ; 1 elsif should_clean? then print_cleaned_program ; 0 elsif invalid_syntax? then print_syntax_error ; 1 else print_program ; (results.has_exception? ? 1 : 0) end end |