Skip to content

Commit ed37cb6

Browse files
committed
less code
1 parent 900a705 commit ed37cb6

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

lib/gon.rb

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,9 @@ def request=(request_id)
4444

4545
def method_missing(m, *args, &block)
4646
if ( m.to_s =~ /=$/ )
47-
if RUBY_VERSION =~ /1.9/
48-
if public_methods.include? m.to_s[0..-2].to_sym
49-
raise "You can't use Gon public methods for storing data"
50-
end
51-
else
52-
if public_methods.include? m.to_s[0..-2]
53-
raise "You can't use Gon public methods for storing data"
54-
end
47+
if public_methods.include?(RUBY_VERSION =~ /1.9/ ? m.to_s[0..-2].to_sym : m.to_s[0..-2])
48+
raise "You can't use Gon public methods for storing data"
5549
end
56-
5750
set_variable(m.to_s.delete('='), args[0])
5851
else
5952
get_variable(m.to_s)

0 commit comments

Comments
 (0)