Class: Ckeditor::PicturePolicy

Inherits:
ApplicationPolicy
  • Object
show all
Defined in:
lib/generators/ckeditor/templates/action_policy/picture_policy.rb,
lib/generators/ckeditor/templates/pundit_policy/picture_policy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, picture) ⇒ PicturePolicy

Returns a new instance of PicturePolicy.



6
7
8
9
# File 'lib/generators/ckeditor/templates/pundit_policy/picture_policy.rb', line 6

def initialize(user, picture)
  @user = user
  @picture = picture
end

Instance Attribute Details

#pictureObject (readonly)

Returns the value of attribute picture.



4
5
6
# File 'lib/generators/ckeditor/templates/pundit_policy/picture_policy.rb', line 4

def picture
  @picture
end

#userObject (readonly)

Returns the value of attribute user.



4
5
6
# File 'lib/generators/ckeditor/templates/pundit_policy/picture_policy.rb', line 4

def user
  @user
end

Instance Method Details

#create?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/generators/ckeditor/templates/action_policy/picture_policy.rb', line 11

def create?
  user.present?
end

#destroy?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/generators/ckeditor/templates/action_policy/picture_policy.rb', line 15

def destroy?
  user.present?
end

#index?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/generators/ckeditor/templates/action_policy/picture_policy.rb', line 7

def index?
  user.present?
end