Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Implement File::NULL #1994

Merged
merged 3 commits into from

2 participants

@jstorimer

This change addresses rubyspec/rubyspec#160 and is based on https://github.com/marcandre/backports/blob/master/lib/backports/1.9.3/file.rb.

I wasn't sure if I should add the spec to this project, or rubyspec, or both? I submitted the PR to rubyspec, let me know if it needs to be submitted here.

Also, my first contributing to rbx, let me know where I got it wrong ;)

@brixen
Owner

Please see the implementation of eg Rubinius.darwin? in the kernel. This needs to follow the same thing.

So, you'll need to add detection for those platforms, but only the ones that Rubinius actually compiles on. I'd be thrilled to see Rubinius running on Amiga, but I don't believe it does, unless you are running it there.

Look at how Rubinius.darwin? is used in FFI.

Finally, this constant should be added in kernel/common not kernel/delta

Thanks for working on this!

@jstorimer

Perfect. That's exactly what I needed. I tried putting it in kernel/common but RUBY_PLATFORM wasn't defined yet, hence I put it in kernel/delta after it was defined. I knew I was missing something.

I put the new const back in kernel/common and removed those other platforms. I've honestly never used Amiga.

@brixen
Owner

@jstorimer Thanks! One more style issue and we're done! Please set NULL for each value instead of that indented case. That indented multi-line expression is inconsistent with our coding style.

@jstorimer

Done. I also swapped the case for an if since there was only one condition.

@brixen brixen merged commit a6389b5 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 0 deletions.
  1. +8 −0 kernel/common/file19.rb
View
8 kernel/common/file19.rb
@@ -143,3 +143,11 @@ def world_writable?
end
end
end
+
+module File::Constants
+ if Rubinius.windows?
+ NULL = 'NUL'
+ else
+ NULL = '/dev/null'
+ end
+end
Something went wrong with that request. Please try again.