Class: Stamina::Gui::Examples::Example

Inherits:
Object
  • Object
show all
Defined in:
lib/stamina-gui/stamina/gui/examples.rb

Overview

class Category

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Example

Returns a new instance of Example.



47
48
49
# File 'lib/stamina-gui/stamina/gui/examples.rb', line 47

def initialize(file)
  @file = file
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



45
46
47
# File 'lib/stamina-gui/stamina/gui/examples.rb', line 45

def file
  @file
end

Instance Method Details

#labelObject



55
56
57
58
# File 'lib/stamina-gui/stamina/gui/examples.rb', line 55

def label
  File.basename(file) =~ /^\d+-(.*)\.rb$/
  $1.gsub(/-/, " ").capitalize
end

#sourceObject



60
61
62
# File 'lib/stamina-gui/stamina/gui/examples.rb', line 60

def source
  File.read(file)
end

#urlObject



51
52
53
# File 'lib/stamina-gui/stamina/gui/examples.rb', line 51

def url
  File.basename(file, ".rb")
end