Skip to content

Commit 5d052f6

Browse files
committed
added method_missing call to get nice accessor functions on Resource
1 parent c4e9aee commit 5d052f6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/esdb/resource.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,10 @@ def to_hash
4444
get! unless @response
4545
JSON.parse(@response)
4646
end
47+
48+
def method_missing(method, *args)
49+
@hash ||= to_hash
50+
return @hash[method.to_s] if @hash.has_key?(method.to_s)
51+
end
4752
end
4853
end

0 commit comments

Comments
 (0)