Class: Journeyviz::Screen
- Inherits:
-
Object
- Object
- Journeyviz::Screen
- Includes:
- NormalizedName
- Defined in:
- lib/journeyviz/screen.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Attributes included from NormalizedName
Instance Method Summary collapse
- #action(name, **params) ⇒ Object
-
#initialize(name, scope = nil) ⇒ Screen
constructor
A new instance of Screen.
Constructor Details
#initialize(name, scope = nil) ⇒ Screen
Returns a new instance of Screen.
13 14 15 16 17 |
# File 'lib/journeyviz/screen.rb', line 13 def initialize(name, scope = nil) assign_normalize_name(name) @actions = [] assign_scope(scope) end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
11 12 13 |
# File 'lib/journeyviz/screen.rb', line 11 def actions @actions end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
11 12 13 |
# File 'lib/journeyviz/screen.rb', line 11 def scope @scope end |
Instance Method Details
#action(name, **params) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/journeyviz/screen.rb', line 19 def action(name, **params) action = Action.new(name, self, **params) if actions.any? { |defined_action| action.name == defined_action.name } raise DuplicatedDefinition, "Duplicated action name: #{name}" end @actions << action end |