Class: Madness::Item
- Inherits:
-
Object
- Object
- Madness::Item
- Includes:
- ServerHelper
- Defined in:
- lib/madness/item.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #dir? ⇒ Boolean
- #file? ⇒ Boolean
- #href ⇒ Object
-
#initialize(path, type) ⇒ Item
constructor
A new instance of Item.
- #label ⇒ Object
Methods included from ServerHelper
Constructor Details
#initialize(path, type) ⇒ Item
Returns a new instance of Item.
8 9 10 |
# File 'lib/madness/item.rb', line 8 def initialize(path, type) @path, @type = path, type end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/madness/item.rb', line 6 def path @path end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/madness/item.rb', line 6 def type @type end |
Instance Method Details
#dir? ⇒ Boolean
20 21 22 |
# File 'lib/madness/item.rb', line 20 def dir? type == :dir end |
#file? ⇒ Boolean
24 25 26 |
# File 'lib/madness/item.rb', line 24 def file? type == :file end |
#href ⇒ Object
16 17 18 |
# File 'lib/madness/item.rb', line 16 def href URI.escape(path_without_extension.sub(/^#{docroot}/, '')) end |
#label ⇒ Object
12 13 14 |
# File 'lib/madness/item.rb', line 12 def label @label ||= label! end |