Class: Helioth::Feature
- Inherits:
-
Object
- Object
- Helioth::Feature
- Defined in:
- lib/helioth/feature.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #action(action_name) ⇒ Object
- #actions(*actions, &block) ⇒ Object
-
#initialize(name, &block) ⇒ Feature
constructor
A new instance of Feature.
- #locales(*locales) ⇒ Object
- #status(status = nil) ⇒ Object
Constructor Details
#initialize(name, &block) ⇒ Feature
Returns a new instance of Feature.
6 7 8 9 10 11 |
# File 'lib/helioth/feature.rb', line 6 def initialize(name, &block) @actions = Array.new @name = name @locales = I18n.available_locales instance_eval(&block) end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/helioth/feature.rb', line 4 def name @name end |
Instance Method Details
#action(action_name) ⇒ Object
27 28 29 30 31 |
# File 'lib/helioth/feature.rb', line 27 def action(action_name) @actions.map{|action| action if action.name == action_name }.compact.first end |
#actions(*actions, &block) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/helioth/feature.rb', line 17 def actions(*actions, &block) if block.nil? @actions else actions.each{|action| @actions << Action.new(action, &block) } end end |
#locales(*locales) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/helioth/feature.rb', line 33 def locales(*locales) unless locales.empty? @locales = locales end @locales end |
#status(status = nil) ⇒ Object
13 14 15 |
# File 'lib/helioth/feature.rb', line 13 def status(status = nil) @status ||= status end |