Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't align values if there's too much whitespace #89

Closed
JoshCheek opened this issue Dec 10, 2016 · 1 comment
Closed

Don't align values if there's too much whitespace #89

JoshCheek opened this issue Dec 10, 2016 · 1 comment

Comments

@JoshCheek
Copy link
Owner

It looks like this each_cons gets run only once, but it's run twice,
it's just that the second output is way off the RHS of the screen.

$stdin =  DATA

commands = [["cat"], ["tr", "a", "A"], ["tr", "c", "C"]]
pipeline = commands.map do |command|
  {command: command, stdin: nil, stdout: nil, stderr: $stderr }
end
pipeline[0][:stdin]   = $stdin
pipeline[-1][:stdout] = $stdout

pipeline.each_cons(2) do |(left, right)|
  1 # => 1,                                                                                                                                                                                          1
  left  # => {:command=>["cat"], :stdin=>#<File:/var/folders/7g/mbft22555w3_2nqs_h1kbglw0000gn/T/seeing_is_believing_temp_dir20161210-34474-12jx18b/program.rb>, :stdout=>nil, :stderr=>#<IO:<STDERR>>}, {:command=>["tr", "a", "A"], :stdin=>nil, :stdout=>nil, :stderr=>#<IO:<STDERR>>}
  right # => {:command=>["tr", "a", "A"], :stdin=>nil, :stdout=>nil, :stderr=>#<IO:<STDERR>>},                                                                                                           {:command=>["tr", "c", "C"], :stdin=>nil, :stdout=>#<IO:<STDOUT>>, :stderr=>#<IO:<STDERR>>}
end

pipeline
# => [{:command=>["cat"],
#      :stdin=>
#       #<File:/var/folders/7g/mbft22555w3_2nqs_h1kbglw0000gn/T/seeing_is_believing_temp_dir20161210-34474-12jx18b/program.rb>,
#      :stdout=>nil,
#      :stderr=>#<IO:<STDERR>>},
#     {:command=>["tr", "a", "A"],
#      :stdin=>nil,
#      :stdout=>nil,
#      :stderr=>#<IO:<STDERR>>},
#     {:command=>["tr", "c", "C"],
#      :stdin=>nil,
#      :stdout=>#<IO:<STDOUT>>,
#      :stderr=>#<IO:<STDERR>>}]

__END__
aaa
bbb
ccc
@ckib16
Copy link
Collaborator

ckib16 commented Jan 29, 2017

@ckib16 ckib16 closed this as completed Jan 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants