Class: Atelier::Library
- Inherits:
-
Object
- Object
- Atelier::Library
- Includes:
- LibraryDSL
- Defined in:
- lib/atelier/library.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #actions ⇒ Object
- #help ⇒ Object
-
#initialize(name, &block) ⇒ Library
constructor
A new instance of Library.
- #libraries ⇒ Object
Methods included from LibraryDSL
Constructor Details
#initialize(name, &block) ⇒ Library
Returns a new instance of Library.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/atelier/library.rb', line 11 def initialize(name, &block) @name = name @title = '' @description = '' @libraries = {} @actions = { libraries: :default, actions: :default, help: :default } instance_eval &block end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/atelier/library.rb', line 9 def name @name end |
Instance Method Details
#actions ⇒ Object
29 30 31 32 |
# File 'lib/atelier/library.rb', line 29 def actions @actions.each { |action_name, action| puts action_name } @actions end |
#help ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/atelier/library.rb', line 34 def help puts "#{name}: #{title}" puts 'default actions:' @actions.each do |action_name, action| puts " - #{name} #{action_name}" if action == :default end puts 'actions:' @actions.each do |action_name, action| puts " - #{name} #{action_name} #{action.synopsis}" unless action == :default end end |
#libraries ⇒ Object
24 25 26 27 |
# File 'lib/atelier/library.rb', line 24 def libraries @libraries.each { |lib_name, lib| puts lib_name } @libraries end |