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
class Context
attr_reader :from, :privacy
def initialize
@from = nil
@privacy = nil
def from
raise NotImplementedError, 'This method must be implemented'
end
def privacy
raise NotImplementedError, 'This method must be implemented'
end
end
......
......@@ -3,9 +3,12 @@
# The PublicContext class specify all collections with field privacy=public
class Collections::PublicContext < Collections::Context
def initialize
@from = 'Collection'
@privacy = 'public'
def from
'Collection'
end
def privacy
'public'
end
end
\ No newline at end of file
......@@ -2,7 +2,10 @@ class UserContext < Collections::Context
def initialize(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
\ No newline at end of file
......@@ -4,7 +4,7 @@
class Collections::UserPrivateContext < Collections::UserContext
def privacy
@privacy = 'private'
'private'
end
end
\ No newline at end of file
......@@ -4,7 +4,7 @@
class Collections::UserPublicContext < Collections::UserContext
def privacy
@privacy = 'public'
'public'
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