Class: Caracal::Core::Models::NamespaceModel

Inherits:
BaseModel
  • Object
show all
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

Instance Method Summary collapse

Methods inherited from BaseModel

#initialize

Constructor Details

This class inherits a constructor from Caracal::Core::Models::BaseModel

Instance Attribute Details

#namespace_hrefObject (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_prefixObject (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 ===============================

Returns:

  • (Boolean)


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 ===========================

Returns:

  • (Boolean)


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