Class: Subledger::Domain::Control
- Inherits:
-
Object
- Object
- Subledger::Domain::Control
- Includes:
- Subledger::Domain, Roles::Activatable, Roles::Archivable, Roles::Attributable, Roles::Collectable, Roles::Creatable, Roles::Identifiable, Roles::Readable, Roles::Restable, Roles::Storable
- Defined in:
- lib/subledger/domain/control.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Entity
Instance Attribute Summary collapse
-
#identity ⇒ Object
readonly
Returns the value of attribute identity.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#verbs ⇒ Object
readonly
Returns the value of attribute verbs.
Attributes included from Roles::Storable
Attributes included from Roles::Identifiable
Class Method Summary collapse
- .active_klass ⇒ Object
- .archived_klass ⇒ Object
- .patch_keys ⇒ Object
- .post_keys ⇒ Object
- .root_klass ⇒ Object
- .sub_klasses ⇒ Object
Instance Method Summary collapse
-
#initialize(args) ⇒ Control
constructor
A new instance of Control.
-
#match?(verb, url) ⇒ Boolean
def is verb, url verb == @verbs and url == @path end.
Methods included from Roles::Restable
#patch_hash, #post_hash, #serializable_hash, #to_json
Methods included from Roles::Archivable
Methods included from Roles::Activatable
Methods included from Roles::Collectable
Methods included from Roles::Readable
Methods included from Roles::Creatable
Methods included from Roles::Attributable
Methods included from Subledger::Domain
#==, #collection_name, #entity_name, included, #to_s
Constructor Details
#initialize(args) ⇒ Control
Returns a new instance of Control.
45 46 47 48 49 50 51 52 53 |
# File 'lib/subledger/domain/control.rb', line 45 def initialize args identifiable args storable args @identity = args[:identity] @verbs = args[:verbs] @path = args[:path] @mode = args[:mode] end |
Instance Attribute Details
#identity ⇒ Object (readonly)
Returns the value of attribute identity.
19 20 21 |
# File 'lib/subledger/domain/control.rb', line 19 def identity @identity end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
19 20 21 |
# File 'lib/subledger/domain/control.rb', line 19 def mode @mode end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
19 20 21 |
# File 'lib/subledger/domain/control.rb', line 19 def path @path end |
#verbs ⇒ Object (readonly)
Returns the value of attribute verbs.
19 20 21 |
# File 'lib/subledger/domain/control.rb', line 19 def verbs @verbs end |
Class Method Details
.active_klass ⇒ Object
37 38 39 |
# File 'lib/subledger/domain/control.rb', line 37 def self.active_klass ActiveControl end |
.archived_klass ⇒ Object
41 42 43 |
# File 'lib/subledger/domain/control.rb', line 41 def self.archived_klass ArchivedControl end |
.patch_keys ⇒ Object
29 30 31 |
# File 'lib/subledger/domain/control.rb', line 29 def self.patch_keys [ ] end |
.post_keys ⇒ Object
25 26 27 |
# File 'lib/subledger/domain/control.rb', line 25 def self.post_keys [ :id, :identity, :verbs, :path, :mode ] end |
.root_klass ⇒ Object
21 22 23 |
# File 'lib/subledger/domain/control.rb', line 21 def self.root_klass Control end |
.sub_klasses ⇒ Object
33 34 35 |
# File 'lib/subledger/domain/control.rb', line 33 def self.sub_klasses [ active_klass, archived_klass ] end |
Instance Method Details
#match?(verb, url) ⇒ Boolean
def is verb, url
verb == @verbs and url == @path
end
71 72 73 |
# File 'lib/subledger/domain/control.rb', line 71 def match? verb, url @verbs.split('|').include?(verb) and match_wildcard(url, @path) end |