lib/loquor/representations.rb in loquor-0.0.1 vs lib/loquor/representations.rb in loquor-0.0.2
- old
+ new
@@ -1,17 +1,14 @@
-{
- "Group::Discussion" => "/group/:group_id/discussions",
- "Group::DiscussionPost" => "/group/:group_id/discussion",
- "MediaFile" => "/media_files",
- "User" => "/users"
-}.each do |name, path|
+Loquor::Representations.each do |name, path|
klass = Class.new(Object) do
extend Loquor::Representation::ClassMethods
include Loquor::Representation::InstanceMethods
- define_method :path do
- path
- end
+ instance_eval <<-EOS
+ def path
+ "#{path}"
+ end
+ EOS
end
# Split off the Group and Discussion parts
name_parts = name.split("::")
klass_name = name_parts.pop