Class: Showcase::Path
- Inherits:
-
Object
- Object
- Showcase::Path
- Defined in:
- app/models/showcase/path.rb
Defined Under Namespace
Classes: Tree
Instance Attribute Summary collapse
-
#basename ⇒ Object
readonly
Returns the value of attribute basename.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#segments ⇒ Object
readonly
Returns the value of attribute segments.
Class Method Summary collapse
Instance Method Summary collapse
- #active?(id) ⇒ Boolean
-
#initialize(path) ⇒ Path
constructor
A new instance of Path.
- #preview_for(view_context) ⇒ Object
Constructor Details
#initialize(path) ⇒ Path
Returns a new instance of Path.
60 61 62 63 64 |
# File 'app/models/showcase/path.rb', line 60 def initialize(path) @id = path.split(".").first.delete_prefix("_").sub(/\/_/, "/") @basename = File.basename(@id) @segments = File.dirname(@id).split("/") end |
Instance Attribute Details
#basename ⇒ Object (readonly)
Returns the value of attribute basename.
58 59 60 |
# File 'app/models/showcase/path.rb', line 58 def basename @basename end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
58 59 60 |
# File 'app/models/showcase/path.rb', line 58 def id @id end |
#segments ⇒ Object (readonly)
Returns the value of attribute segments.
58 59 60 |
# File 'app/models/showcase/path.rb', line 58 def segments @segments end |
Class Method Details
Instance Method Details
#active?(id) ⇒ Boolean
69 70 71 |
# File 'app/models/showcase/path.rb', line 69 def active?(id) self.id == id end |