Class: Entitled::ResourceTitle

Inherits:
Title
  • Object
show all
Defined in:
lib/entitled/entitled.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Title

#path?

Constructor Details

#initialize(resource_or_string) ⇒ ResourceTitle

Returns a new instance of ResourceTitle.



70
71
72
73
# File 'lib/entitled/entitled.rb', line 70

def initialize resource_or_string
  @resource = resource_or_string unless resource_or_string.class == String
  @text     = resource_or_string.to_s
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



68
69
70
# File 'lib/entitled/entitled.rb', line 68

def resource
  @resource
end

#textObject (readonly)

Returns the value of attribute text.



68
69
70
# File 'lib/entitled/entitled.rb', line 68

def text
  @text
end

Instance Method Details

#path_objectObject



75
76
77
# File 'lib/entitled/entitled.rb', line 75

def path_object
  @resource if navigable?
end

#resource?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/entitled/entitled.rb', line 79

def resource?
  @resource.present?
end