Skip to content
Snippets Groups Projects
Commit 655985dd authored by Mauricio Giacomini Girardello's avatar Mauricio Giacomini Girardello
Browse files

change methods call from contexts

parent ca8d7f6c
No related branches found
No related tags found
No related merge requests found
module Collections module Collections
class Context class Context
attr_reader :from, :privacy
def initialize def from
@from = nil raise NotImplementedError, 'This method must be implemented'
@privacy = nil end
def privacy
raise NotImplementedError, 'This method must be implemented'
end end
end end
......
...@@ -3,9 +3,12 @@ ...@@ -3,9 +3,12 @@
# The PublicContext class specify all collections with field privacy=public # The PublicContext class specify all collections with field privacy=public
class Collections::PublicContext < Collections::Context class Collections::PublicContext < Collections::Context
def initialize def from
@from = 'Collection' 'Collection'
@privacy = 'public' end
def privacy
'public'
end end
end end
\ No newline at end of file
...@@ -2,7 +2,10 @@ class UserContext < Collections::Context ...@@ -2,7 +2,10 @@ class UserContext < Collections::Context
def initialize(user) def initialize(user)
@user = user @user = user
@from = sprintf "select expand(in('BelongsTo')) from %s)", user.rid end
def from
sprintf "select expand(in('BelongsTo')) from %s)", @user.rid
end end
end end
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
class Collections::UserPrivateContext < Collections::UserContext class Collections::UserPrivateContext < Collections::UserContext
def privacy def privacy
@privacy = 'private' 'private'
end end
end end
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
class Collections::UserPublicContext < Collections::UserContext class Collections::UserPublicContext < Collections::UserContext
def privacy def privacy
@privacy = 'public' 'public'
end end
end end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment