Skip to content

Commit

Permalink
Trivial changes to match style
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed Nov 15, 2016
1 parent e56ded2 commit 83001be
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions core/src/main/java/org/jruby/RubyFile.java
Expand Up @@ -785,21 +785,15 @@ public static String dirname(ThreadContext context, String jfilename) {
}

@JRubyMethod(name = {"empty?", "zero?"}, required = 1, meta = true)
public static IRubyObject empty(ThreadContext context, IRubyObject self, IRubyObject str) {
public static IRubyObject empty_p(ThreadContext context, IRubyObject self, IRubyObject str) {
Ruby runtime = context.runtime;
String f = StringSupport.checkEmbeddedNulls(runtime, get_path(context, str)).getUnicodeValue();
String filename = StringSupport.checkEmbeddedNulls(runtime, get_path(context, str)).getUnicodeValue();

if ( ! new File(f).exists() ) {
return runtime.getFalse();
}
if (!new File(filename).exists()) return runtime.getFalse();

int size = runtime.newFileStat(f, false).size().convertToInteger().getIntValue();
if (size == 0) {
return runtime.getTrue();
}
else {
return runtime.getFalse();
}
int size = runtime.newFileStat(filename, false).size().convertToInteger().getIntValue();

return runtime.newBoolean(size == 0);
}

/**
Expand Down

0 comments on commit 83001be

Please sign in to comment.