Class: Stamina::Gui::Examples::Category
- Inherits:
-
Object
- Object
- Stamina::Gui::Examples::Category
- Includes:
- Enumerable
- Defined in:
- lib/stamina-gui/stamina/gui/examples.rb
Instance Attribute Summary collapse
-
#folder ⇒ Object
readonly
Returns the value of attribute folder.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(folder) ⇒ Category
constructor
A new instance of Category.
- #label ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(folder) ⇒ Category
Returns a new instance of Category.
22 23 24 |
# File 'lib/stamina-gui/stamina/gui/examples.rb', line 22 def initialize(folder) @folder = folder end |
Instance Attribute Details
#folder ⇒ Object (readonly)
Returns the value of attribute folder.
20 21 22 |
# File 'lib/stamina-gui/stamina/gui/examples.rb', line 20 def folder @folder end |
Instance Method Details
#each ⇒ Object
35 36 37 38 39 |
# File 'lib/stamina-gui/stamina/gui/examples.rb', line 35 def each Dir[File.join(folder, "*.rb")].sort.each do |file| yield(Example.new(file)) end end |
#label ⇒ Object
30 31 32 33 |
# File 'lib/stamina-gui/stamina/gui/examples.rb', line 30 def label File.basename(folder) =~ /^\d+-(.*)$/ $1.gsub(/-/, " ").capitalize end |
#url ⇒ Object
26 27 28 |
# File 'lib/stamina-gui/stamina/gui/examples.rb', line 26 def url File.basename(folder) end |