arkaan 2.7.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/arkaan.rb +18 -16
  3. data/lib/arkaan/account.rb +22 -19
  4. data/lib/arkaan/authentication.rb +3 -1
  5. data/lib/arkaan/authentication/session.rb +10 -7
  6. data/lib/arkaan/campaign.rb +21 -19
  7. data/lib/arkaan/campaigns.rb +4 -2
  8. data/lib/arkaan/campaigns/invitation.rb +2 -2
  9. data/lib/arkaan/chatrooms.rb +7 -5
  10. data/lib/arkaan/chatrooms/base.rb +3 -1
  11. data/lib/arkaan/chatrooms/campaign.rb +3 -1
  12. data/lib/arkaan/chatrooms/conversation.rb +5 -1
  13. data/lib/arkaan/chatrooms/membership.rb +6 -2
  14. data/lib/arkaan/chatrooms/message.rb +5 -3
  15. data/lib/arkaan/concerns.rb +10 -8
  16. data/lib/arkaan/concerns/activable.rb +6 -4
  17. data/lib/arkaan/concerns/diagnosticable.rb +7 -5
  18. data/lib/arkaan/concerns/enumerable.rb +21 -9
  19. data/lib/arkaan/concerns/historizable.rb +7 -5
  20. data/lib/arkaan/concerns/mime_typable.rb +18 -10
  21. data/lib/arkaan/concerns/premiumable.rb +3 -1
  22. data/lib/arkaan/concerns/sluggable.rb +9 -8
  23. data/lib/arkaan/concerns/typable.rb +5 -3
  24. data/lib/arkaan/factories.rb +4 -2
  25. data/lib/arkaan/files.rb +6 -2
  26. data/lib/arkaan/files/document.rb +5 -3
  27. data/lib/arkaan/files/permission.rb +4 -2
  28. data/lib/arkaan/monitoring.rb +4 -2
  29. data/lib/arkaan/monitoring/route.rb +6 -3
  30. data/lib/arkaan/monitoring/service.rb +5 -3
  31. data/lib/arkaan/notification.rb +5 -2
  32. data/lib/arkaan/oauth.rb +6 -4
  33. data/lib/arkaan/oauth/access_token.rb +10 -8
  34. data/lib/arkaan/oauth/application.rb +18 -12
  35. data/lib/arkaan/oauth/authorization.rb +8 -6
  36. data/lib/arkaan/oauth/refresh_token.rb +7 -4
  37. data/lib/arkaan/permissions.rb +5 -3
  38. data/lib/arkaan/permissions/category.rb +4 -2
  39. data/lib/arkaan/permissions/group.rb +4 -2
  40. data/lib/arkaan/permissions/right.rb +8 -4
  41. data/lib/arkaan/ruleset.rb +6 -4
  42. metadata +104 -54
  43. data/lib/arkaan/decorators/errors.rb +0 -9
  44. data/lib/arkaan/decorators/errors/env_variable_missing.rb +0 -14
  45. data/lib/arkaan/decorators/gateway.rb +0 -109
  46. data/lib/arkaan/factories/errors.rb +0 -9
  47. data/lib/arkaan/factories/errors/gateway_not_found.rb +0 -14
  48. data/lib/arkaan/version.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6071d575435983f455e7d27bc319a2ae2b0e41c0af841de7cc1d913b9de361cc
4
- data.tar.gz: 80679ea438105b33983fd988e9983d93b5f5ec9fd62814f559790105b3838029
3
+ metadata.gz: 99aa03dc8a6f14cf981a81b89ab54adf9450c7bf2646a8231883ec71673d5695
4
+ data.tar.gz: 1e852dcc77ae4418286c94b7390888b3f8e71c57770852548cdf585ec300cea8
5
5
  SHA512:
6
- metadata.gz: bbbb37a386bad165d89dbfcd9e21c6b1a3d6b05897c32b0f35ff1fc337c140aa62c65f87908cf9d78e3929022c92e83279ace0c74b09d498601a190401752b90
7
- data.tar.gz: dad545ddc2fba3fbc89c08492c2a8ebaf854d87d44511fbedb2fc6595cb2d715705c2a31d4bf48cc9e4802aa35863eaf210f7f19d17fde054b07e1a8e5046295
6
+ metadata.gz: 7fb7d81811559f1daff3971c65b80d323ad9c29705e96b5cc3d6ba2729234498b094955e76478148c3876b2aeb62f6dad5806d34f6fae6761d0fecb86d495917
7
+ data.tar.gz: 4d2398bdc636a6b2307d4d4c101cf7f75e0e74b958f13e1d37d7e22addbbbfaec96022565737212c9f7b4beacd8f94e4f956f73a43203ca057612c8f50b33683
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'mongoid'
2
4
  require 'active_model'
3
5
  require 'active_support'
@@ -6,20 +8,20 @@ require 'dotenv/load'
6
8
  # Main module of the application, holding all the subsequent classes.
7
9
  # @author Vincent Courtois <courtois.vincent@outlook.com>
8
10
  module Arkaan
9
- autoload :Account , 'arkaan/account'
11
+ autoload :Account, 'arkaan/account'
10
12
  autoload :Authentication, 'arkaan/authentication'
11
- autoload :Campaign , 'arkaan/campaign'
12
- autoload :Campaigns , 'arkaan/campaigns'
13
- autoload :Chatroom , 'arkaan/chatroom'
14
- autoload :Chatrooms , 'arkaan/chatrooms'
15
- autoload :Concerns , 'arkaan/concerns'
16
- autoload :Event , 'arkaan/event'
17
- autoload :Factories , 'arkaan/factories'
18
- autoload :Files , 'arkaan/files'
19
- autoload :Monitoring , 'arkaan/monitoring'
20
- autoload :Notification , 'arkaan/notification'
21
- autoload :OAuth , 'arkaan/oauth'
22
- autoload :Permissions , 'arkaan/permissions'
23
- autoload :Phone , 'arkaan/phone'
24
- autoload :Ruleset , 'arkaan/ruleset'
25
- end
13
+ autoload :Campaign, 'arkaan/campaign'
14
+ autoload :Campaigns, 'arkaan/campaigns'
15
+ autoload :Chatroom, 'arkaan/chatroom'
16
+ autoload :Chatrooms, 'arkaan/chatrooms'
17
+ autoload :Concerns, 'arkaan/concerns'
18
+ autoload :Event, 'arkaan/event'
19
+ autoload :Factories, 'arkaan/factories'
20
+ autoload :Files, 'arkaan/files'
21
+ autoload :Monitoring, 'arkaan/monitoring'
22
+ autoload :Notification, 'arkaan/notification'
23
+ autoload :OAuth, 'arkaan/oauth'
24
+ autoload :Permissions, 'arkaan/permissions'
25
+ autoload :Phone, 'arkaan/phone'
26
+ autoload :Ruleset, 'arkaan/ruleset'
27
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Arkaan
2
4
  # A user account with all related attributes. It holds credentials and informations about a designated user.
3
5
  # @author Vincent Courtois <courtois.vincent@outlook.com>
@@ -8,7 +10,7 @@ module Arkaan
8
10
  include Arkaan::Concerns::Enumerable
9
11
 
10
12
  # @!attribute [rw] username
11
- # @return [String] the nickname the user chose at subscription, must be given, unique, and 6 or more characters long.
13
+ # @return [String] the current name identifying the user on the GUI.
12
14
  field :username, type: String
13
15
  # @!attribute [r] password_digest
14
16
  # @return [String] the password of the user, encrypted with the Blowfish algorithm.
@@ -20,30 +22,31 @@ module Arkaan
20
22
  # @return [String] the first name of the user.
21
23
  field :firstname, type: String, default: ''
22
24
  # @!attribute [rw] email
23
- # @return [String] the email address of the user, useful to contact them ; it must be given, unique, and have an email format.
25
+ # @return [String] the email address of the user, useful to contact them.
24
26
  field :email, type: String
25
27
  # @!attribute [rw] language
26
28
  # @return [Symbol] the language preferred by this user.
27
- enum_field :language, [:en_GB, :fr_FR], default: :fr_FR
29
+ enum_field :language, %i[en_GB fr_FR], default: :fr_FR
28
30
  # @!attribute [rw] gender
29
31
  # @return [Symbol] the way you prefer the application to gender you.
30
- enum_field :gender, [:female, :male, :neutral], default: :neutral
32
+ enum_field :gender, %i[female male neutral], default: :neutral
31
33
 
32
34
  # @!attribute [w] password
33
- # @return [String] password, in clear, of the user ; do not attempt to get the value, just set it when changing the password.
35
+ # @return [String] password, in clear, of the user if you just changed it.
34
36
  # @!attribute [w] password_confirmation
35
- # @return [String] the confirmation of the password, do not get, just set it ; it must be the same as the password.
37
+ # @return [String] the confirmation of the password, that matches the password itself.
36
38
  has_secure_password validations: false
37
39
 
38
40
  # @!attribute [rw] groups
39
41
  # @return [Array<Arkaan::Permissions::Group>] the groups giving their corresponding rights to the current account.
40
42
  has_and_belongs_to_many :groups, class_name: 'Arkaan::Permissions::Group', inverse_of: :accounts
41
-
43
+
42
44
  # @!attribute [rw] applications
43
45
  # @return [Array<Arkaan::OAuth::Application] the applications this user has created and owns.
44
46
  has_many :applications, class_name: 'Arkaan::OAuth::Application', inverse_of: :creator
45
47
  # @!attribute [rw] authorizations
46
- # @return [Array<Arkaan::OAuth::Authorization>] the authorization issued by this account to third-party applications to access its data.
48
+ # @return [Array<Arkaan::OAuth::Authorization>] the authorization issued by this account
49
+ # to third-party applications to access its data.
47
50
  has_many :authorizations, class_name: 'Arkaan::OAuth::Authorization', inverse_of: :account
48
51
  # @!attribute [rw] services
49
52
  # @return [Array<Arkaan::Monitoring::Service>] the services created by this user.
@@ -75,26 +78,26 @@ module Arkaan
75
78
  notifications.where(read: false)
76
79
  end
77
80
 
78
- # @return [Array<Arkaan::Notification>] the notifications already read, less important to display than the unread ones.
81
+ # @return [Array<Arkaan::Notification>] the notifications already read byt the user.
79
82
  def read_notifications
80
83
  notifications.where(read: true)
81
84
  end
82
85
 
83
86
  validates :username,
84
- presence: {message: 'required'},
85
- length: {minimum: 6, message: 'minlength', if: :username?},
86
- uniqueness: {message: 'uniq', if: :username?}
87
+ presence: { message: 'required' },
88
+ length: { minimum: 6, message: 'minlength', if: :username? },
89
+ uniqueness: { message: 'uniq', if: :username? }
87
90
 
88
91
  validates :email,
89
- presence: {message: 'required'},
90
- format: {with: /\A[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}\z/, message: 'pattern', if: :email?},
91
- uniqueness: {message: 'uniq', if: :email?}
92
+ presence: { message: 'required' },
93
+ format: { with: /\A[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}\z/, message: 'pattern', if: :email? },
94
+ uniqueness: { message: 'uniq', if: :email? }
92
95
 
93
96
  validates :password,
94
- presence: {message: 'required', if: ->{ !persisted? || password_digest_changed? }},
95
- confirmation: {message: 'confirmation', if: :password_digest_changed?}
97
+ presence: { message: 'required', if: -> { !persisted? || password_digest_changed? } },
98
+ confirmation: { message: 'confirmation', if: :password_digest_changed? }
96
99
 
97
100
  validates :password_confirmation,
98
- presence: {message: 'required', if: :password_digest_changed?}
101
+ presence: { message: 'required', if: :password_digest_changed? }
99
102
  end
100
- end
103
+ end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Arkaan
2
4
  # This module holds the logic for user authentication to our frontend.
3
5
  # @author Vincent Courtois <courtois.vincent@outlook.com>
4
6
  module Authentication
5
7
  autoload :Session, 'arkaan/authentication/session'
6
8
  end
7
- end
9
+ end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Arkaan
2
4
  module Authentication
3
5
  # A session represents the connection of the user on our frontend application. Nobody else than our frontend should
4
- # have access to the session or it's content (in particular to the token), instead they shall use the OAuth2.0 protocol.
6
+ # have access to the session or it's content (in particular to the token), instead they shall use OAuth2.0.
5
7
  # A session shall ONLY be created by a premium application (only our frontend applications are premium).
6
8
  # @author Vincent Courtois <courtois.vincent@outlook.com>
7
9
  class Session
@@ -9,10 +11,11 @@ module Arkaan
9
11
  include Mongoid::Timestamps
10
12
 
11
13
  # @!attribute [rw] token
12
- # @return [String] the unique token for this session, used to identify it and be sure the user is connected on this application.
14
+ # @return [String] the unique token for this session, used to identify it and be sure the user is connected.
13
15
  field :token, type: String
14
16
  # @!attribute [rw] websocket_id
15
- # @return [String] the ID of the websocket on which the session is connected. It's not an association because instances are embedded.
17
+ # @return [String] the ID of the websocket the user is connected to.
18
+ # It's not an association because instances are embedded.
16
19
  field :websocket_id, type: String, default: ''
17
20
 
18
21
  # @!attribute [rw] account
@@ -20,9 +23,9 @@ module Arkaan
20
23
  belongs_to :account, class_name: 'Arkaan::Account', inverse_of: :sessions
21
24
 
22
25
  validates :token,
23
- presence: {message: 'required'},
24
- uniqueness: {message: 'uniq', if: :token?},
25
- length: {minimum: 10, message: 'minlength', if: :token?}
26
+ presence: { message: 'required' },
27
+ uniqueness: { message: 'uniq', if: :token? },
28
+ length: { minimum: 10, message: 'minlength', if: :token? }
26
29
  end
27
30
  end
28
- end
31
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Arkaan
2
4
  # A campaign is a gathering of accounts playing on the same interface, and interacting in a common game.
3
5
  # @author Vincent Courtois <courtois.vincent@outlook.com>
@@ -12,7 +14,7 @@ module Arkaan
12
14
  # @return [String] a more detailed description, used to give further information about the campaign in general.
13
15
  field :description, type: String
14
16
  # @!attribute [rw] is_private
15
- # @return [Boolean] TRUE if the campaign can be joined only by being invited by the creator, FALSE if it's publicly displayed and accessible.
17
+ # @return [Boolean] TRUE if the campaign can be joined only by being invited by the creator, FALSE if public.
16
18
  field :is_private, type: Boolean, default: true
17
19
  # @!attribute [rw] tags
18
20
  # @return [Array<String>] an array of tags describing characteristics of this campaign.
@@ -37,11 +39,11 @@ module Arkaan
37
39
  belongs_to :ruleset, class_name: 'Arkaan::Ruleset', inverse_of: :campaigns, optional: true
38
40
 
39
41
  validates :title,
40
- presence: {message: 'required'},
41
- length: {minimum: 4, message: 'minlength', if: :title?}
42
+ presence: { message: 'required' },
43
+ length: { minimum: 4, message: 'minlength', if: :title? }
42
44
 
43
45
  validates :max_players,
44
- numericality: {less_than: 21, message: 'maximum'}
46
+ numericality: { less_than: 21, message: 'maximum' }
45
47
 
46
48
  validate :title_unicity
47
49
 
@@ -50,13 +52,13 @@ module Arkaan
50
52
  # Sets the creator of the campaign. This method is mainly used for backward-compatibility needs.
51
53
  # @param account [Arkaan::Account] the account of the creator for this campaign.
52
54
  def creator=(account)
53
- if !invitations.where(account: account).exists?
54
- invitation = Arkaan::Campaigns::Invitation.create(
55
- campaign: self,
56
- account: account,
57
- status: :creator
58
- )
59
- end
55
+ return if invitations.where(account: account).exists?
56
+
57
+ Arkaan::Campaigns::Invitation.create(
58
+ campaign: self,
59
+ account: account,
60
+ status: :creator
61
+ )
60
62
  end
61
63
 
62
64
  # Getter for the creator account of this campaign.
@@ -71,24 +73,24 @@ module Arkaan
71
73
  campaign_ids = creator.invitations.where(:campaign_id.ne => _id).pluck(:campaign_id)
72
74
  # With this list of campaign IDs, we look for a campaign with the same title.
73
75
  same_title_campaign = Arkaan::Campaign.where(:_id.in => campaign_ids, title: title)
74
- if !creator.nil? && title? && same_title_campaign.exists?
75
- errors.add(:title, 'uniq')
76
- end
76
+ return unless !creator.nil? && title? && same_title_campaign.exists?
77
+
78
+ errors.add(:title, 'uniq')
77
79
  end
78
80
 
79
81
  # Validation for the max number of players for a campaign.
80
82
  # If there is a max number of players, and the current number of
81
83
  # players is above it, or the max number of players is 0, raises an error.
82
84
  def max_players_minimum
83
- if max_players? && (max_players < players_count || max_players < 1)
84
- errors.add(:max_players, 'minimum')
85
- end
85
+ return unless max_players? && (max_players < players_count || max_players < 1)
86
+
87
+ errors.add(:max_players, 'minimum')
86
88
  end
87
89
 
88
90
  # @return [Array<Arkaan::Campaigns::Invitation>] the players in this campaign.
89
91
  def players
90
92
  invitations.to_a.select do |invitation|
91
- [:creator, :accepted].include? invitation.enum_status
93
+ %i[creator accepted].include? invitation.enum_status
92
94
  end
93
95
  end
94
96
 
@@ -105,4 +107,4 @@ module Arkaan
105
107
  self.chatroom = Arkaan::Chatrooms::Campaign.new(campaign: self)
106
108
  end
107
109
  end
108
- end
110
+ end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Arkaan
2
4
  # The campaigns module is holding the logic for some objects related to campaigns.
3
5
  # @author Vincent Courtois <courtois.vincent@outlook.com>
4
6
  module Campaigns
5
7
  autoload :Invitation, 'arkaan/campaigns/invitation'
6
- autoload :Tag , 'arkaan/campaigns/tag'
8
+ autoload :Tag, 'arkaan/campaigns/tag'
7
9
  end
8
- end
10
+ end
@@ -22,8 +22,8 @@ module Arkaan
22
22
  # @!attribute [rw] status
23
23
  # @return [Symbol] the current status of the invitation.
24
24
  historize enum_field :status,
25
- [:pending, :request, :accepted, :refused, :expelled, :left, :master, :creator],
26
- default: :pending
25
+ %i[pending request accepted refused expelled left master creator],
26
+ default: :pending
27
27
  end
28
28
  end
29
29
  end
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Arkaan
2
4
  # The chatrooms modules regroup all classes concerning messages between players.
3
5
  # @author Vincent Courtois <courtois.vincent@outlook.com>
4
6
  module Chatrooms
5
- autoload :Base , 'arkaan/chatrooms/base'
6
- autoload :Campaign , 'arkaan/chatrooms/campaign'
7
+ autoload :Base, 'arkaan/chatrooms/base'
8
+ autoload :Campaign, 'arkaan/chatrooms/campaign'
7
9
  autoload :Conversation, 'arkaan/chatrooms/conversation'
8
- autoload :Message , 'arkaan/chatrooms/message'
9
- autoload :Membership , 'arkaan/chatrooms/membership'
10
+ autoload :Message, 'arkaan/chatrooms/message'
11
+ autoload :Membership, 'arkaan/chatrooms/membership'
10
12
  end
11
- end
13
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Arkaan
2
4
  module Chatrooms
3
5
  # The base chatroom class, made to be subclassed in campaign and personal chatrooms.
@@ -11,4 +13,4 @@ module Arkaan
11
13
  has_many :messages, class_name: 'Arkaan::Chatrooms::Message', inverse_of: :chatroom
12
14
  end
13
15
  end
14
- end
16
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Arkaan
2
4
  module Chatrooms
3
5
  # Represents the chatroom embedded in a campaign.
@@ -8,4 +10,4 @@ module Arkaan
8
10
  embedded_in :campaign, class_name: 'Arkaan::Campaign', inverse_of: :chatroom
9
11
  end
10
12
  end
11
- end
13
+ end
@@ -1,7 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Arkaan
2
4
  module Chatrooms
5
+ # A conversation is an exchange of messages between several users.
6
+ # @author Vincent Courtois <courtois.vincent@outlook.com>
3
7
  class Conversation < Arkaan::Chatrooms::Base
4
8
  has_many :memberships, class_name: 'Arkaan::Chatrooms::Membership', inverse_of: :chatroom
5
9
  end
6
10
  end
7
- end
11
+ end
@@ -1,15 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Arkaan
2
4
  module Chatrooms
5
+ # A membership is the link between a user and a conversation.
6
+ # @author Vincent Courtois <courtois.vincent@outlook.com>
3
7
  class Membership
4
8
  include Mongoid::Document
5
9
  include Mongoid::Timestamps
6
10
  include Arkaan::Concerns::Enumerable
7
11
 
8
- enum_field :status, [:shown, :hidden], default: :shown
12
+ enum_field :status, %i[shown hidden], default: :shown
9
13
 
10
14
  belongs_to :chatroom, class_name: 'Arkaan::Chatrooms::Private', inverse_of: :memberships
11
15
 
12
16
  belongs_to :account, class_name: 'Arkaan::Account', inverse_of: :memberships
13
17
  end
14
18
  end
15
- end
19
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Arkaan
2
4
  module Chatrooms
3
5
  # This model represents an in-game tchat message sent in the tchat of a campaign.
@@ -8,8 +10,8 @@ module Arkaan
8
10
  include Arkaan::Concerns::Enumerable
9
11
 
10
12
  # @!attribute [rw] type
11
- # @return [Symbol] the type of message (plain text or command) contained in the data, used to parse and display it.
12
- enum_field :type, [:text, :command], default: :text
13
+ # @return [Symbol] the type of message (plain text or command) contained in the data, used to display it.
14
+ enum_field :type, %i[text command], default: :text
13
15
  # @!attribute [rw] data
14
16
  # @return [Hash] the additional data passed to the message (arguments of the command, or content of the text)
15
17
  field :data, type: Hash, default: {}
@@ -28,4 +30,4 @@ module Arkaan
28
30
  belongs_to :account, class_name: 'Arkaan::Account', inverse_of: :messages
29
31
  end
30
32
  end
31
- end
33
+ end
@@ -1,14 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Arkaan
2
4
  # This module holds the shared concerns to include in the desired models.
3
5
  # @author Vincent Courtois <courtois.vincent@outlook.com>
4
6
  module Concerns
5
- autoload :Activable , 'arkaan/concerns/activable'
7
+ autoload :Activable, 'arkaan/concerns/activable'
6
8
  autoload :Diagnosticable, 'arkaan/concerns/diagnosticable'
7
- autoload :Enumerable , 'arkaan/concerns/enumerable'
8
- autoload :Historizable , 'arkaan/concerns/historizable'
9
- autoload :MimeTypable , 'arkaan/concerns/mime_typable'
10
- autoload :Premiumable , 'arkaan/concerns/premiumable'
11
- autoload :Sluggable , 'arkaan/concerns/sluggable'
12
- autoload :Typable , 'arkaan/concerns/typable'
9
+ autoload :Enumerable, 'arkaan/concerns/enumerable'
10
+ autoload :Historizable, 'arkaan/concerns/historizable'
11
+ autoload :MimeTypable, 'arkaan/concerns/mime_typable'
12
+ autoload :Premiumable, 'arkaan/concerns/premiumable'
13
+ autoload :Sluggable, 'arkaan/concerns/sluggable'
14
+ autoload :Typable, 'arkaan/concerns/typable'
13
15
  end
14
- end
16
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Arkaan
2
4
  module Concerns
3
5
  # Concerns for the objects that can be activated or deactivated, included the corresponding scopes.
@@ -9,10 +11,10 @@ module Arkaan
9
11
  # @!attribute [rw] active
10
12
  # @return [Boolean] the active status of the instance, indicating if someone has deactivated it or not.
11
13
  field :active, type: Boolean, default: true
12
-
13
- scope :active , ->{ where(active: true) }
14
- scope :inactive, ->{ where(active: false) }
14
+
15
+ scope :active, -> { where(active: true) }
16
+ scope :inactive, -> { where(active: false) }
15
17
  end
16
18
  end
17
19
  end
18
- end
20
+ end