sandal (owner)

Revisions

gist: 119440 Download_button fork
public
Public Clone URL: git://gist.github.com/119440.git
Embed All Files: show embed
ruby.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
if RUBY_VERSION < "1.9"
  def ruby18
    yield
  end
  def ruby19
    false
  end
else
  def ruby18
    false
  end
  def ruby19
     yield
  end
end
 
# later
 
def read_file
  ruby18 { File.read("foo.txt") } ||
  ruby19 { File.read("foo.txt", :encoding => "UTF-8" }
end