Class: Caracal::Core::Models::NamespaceModel
- Defined in:
- lib/caracal/core/models/namespace_model.rb
Overview
This class encapsulates the logic needed to store and manipulate namespace data.
Instance Attribute Summary collapse
-
#namespace_href ⇒ Object
readonly
Returns the value of attribute namespace_href.
-
#namespace_prefix ⇒ Object
readonly
accessors.
Instance Method Summary collapse
-
#matches?(str) ⇒ Boolean
STATE ===============================.
-
#valid? ⇒ Boolean
VALIDATION ===========================.
Methods inherited from BaseModel
Constructor Details
This class inherits a constructor from Caracal::Core::Models::BaseModel
Instance Attribute Details
#namespace_href ⇒ Object (readonly)
Returns the value of attribute namespace_href.
19 20 21 |
# File 'lib/caracal/core/models/namespace_model.rb', line 19 def namespace_href @namespace_href end |
#namespace_prefix ⇒ Object (readonly)
accessors
18 19 20 |
# File 'lib/caracal/core/models/namespace_model.rb', line 18 def namespace_prefix @namespace_prefix end |
Instance Method Details
#matches?(str) ⇒ Boolean
STATE ===============================
39 40 41 |
# File 'lib/caracal/core/models/namespace_model.rb', line 39 def matches?(str) namespace_prefix == str.to_s end |
#valid? ⇒ Boolean
VALIDATION ===========================
46 47 48 49 |
# File 'lib/caracal/core/models/namespace_model.rb', line 46 def valid? required = [:href, :prefix] required.all? { |m| !send("namespace_#{ m }").nil? } end |