Class: Kamaze::Project::Helper
- Includes:
- Singleton
- Defined in:
- lib/kamaze/project/helper.rb
Overview
Provides access to helper classes
Defined Under Namespace
Class Attribute Summary collapse
-
.ns ⇒ Object
readonly
Returns the value of attribute ns.
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
protected
Returns the value of attribute items.
Instance Method Summary collapse
- #get(name) ⇒ Object
- #inflector ⇒ Sys::Proc::Helper::Inflector protected
-
#initialize ⇒ Helper
constructor
protected
A new instance of Helper.
- #to_h ⇒ Hash protected
Constructor Details
Class Attribute Details
.ns ⇒ Object (readonly)
Returns the value of attribute ns.
17 18 19 |
# File 'lib/kamaze/project/helper.rb', line 17 def ns @ns end |
Instance Attribute Details
#items ⇒ Object (readonly, protected)
Returns the value of attribute items.
40 41 42 |
# File 'lib/kamaze/project/helper.rb', line 40 def items @items end |
Instance Method Details
#get(name) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/kamaze/project/helper.rb', line 26 def get(name) name = name.to_sym return items[name] if items[name] begin @items[name] = inflector.resolve("#{self.class.ns}/#{name}").new rescue LoadError raise NotImplementedError, "helper not loadable: #{name}" end end |
#inflector ⇒ Sys::Proc::Helper::Inflector (protected)
60 61 62 |
# File 'lib/kamaze/project/helper.rb', line 60 def inflector to_h.fetch(:inflector) end |
#to_h ⇒ Hash (protected)
55 56 57 |
# File 'lib/kamaze/project/helper.rb', line 55 def to_h items end |