Skip to content

Commit

Permalink
Added a mixin to take care of common code among resources
Browse files Browse the repository at this point in the history
  • Loading branch information
gterrono committed Jan 17, 2013
1 parent db63a90 commit 55fd107
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/classes/resource.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module PCR
module Resource
def set_attrs(attrs, json)
attrs.each do |attr|
self.instance_variable_set("@#{attr}", json['result'][attr] || json[attr])
end
end
end
end

0 comments on commit 55fd107

Please sign in to comment.