Class: Docks::Containers::Demo
- Inherits:
-
Object
- Object
- Docks::Containers::Demo
- Defined in:
- lib/docks/containers/demo_container.rb
Overview
Public: a container for demos. This is a special type of container in that it does not correspond directly to a symbol from the parse results. Instead, it encapsulates and provides helper methods for sets of components that require a demo.
Instance Attribute Summary collapse
-
#component ⇒ Object
readonly
Returns the value of attribute component.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
-
.type ⇒ Object
Public: the type of symbols that should be encapsulated by this container.
Instance Method Summary collapse
-
#initialize(component) ⇒ Demo
constructor
Public: initializes a new demo.
-
#joint_variations ⇒ Object
Public: collects all the variations of the demo’ed components that should be presented as joint demos.
-
#select_variations(options = {}) ⇒ Object
Public: collects all variations on the components that are being demo’ed that were specified to be “select” types.
Constructor Details
#initialize(component) ⇒ Demo
Public: initializes a new demo.
25 26 27 28 |
# File 'lib/docks/containers/demo_container.rb', line 25 def initialize(component) @component = component @name = component.name end |
Instance Attribute Details
#component ⇒ Object (readonly)
Returns the value of attribute component.
21 22 23 |
# File 'lib/docks/containers/demo_container.rb', line 21 def component @component end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
21 22 23 |
# File 'lib/docks/containers/demo_container.rb', line 21 def name @name end |
Class Method Details
.type ⇒ Object
Public: the type of symbols that should be encapsulated by this container. This is compared against a symbol’s ‘symbol_type` to determine which container to use.
Returns the type String.
19 |
# File 'lib/docks/containers/demo_container.rb', line 19 def self.type; Docks::Types::Symbol::DEMO end |
Instance Method Details
#joint_variations ⇒ Object
Public: collects all the variations of the demo’ed components that should be presented as joint demos.
Returns an Array of “joint”-type variations.
51 52 53 |
# File 'lib/docks/containers/demo_container.rb', line 51 def joint_variations variations_of_type(Docks::Types::Demo::JOINT) end |
#select_variations(options = {}) ⇒ Object
Public: collects all variations on the components that are being demo’ed that were specified to be “select” types. The optional options Hash allows you to choose whether or not to group the result by base class (using the ‘group_by_component` key of `true`), in which case the result will be a Hash of Arrays where the keys are the base classes. Otherwise, a simple Array of variation symbols is returned.
options - A hash of options. Defaults to {}.
Returns a Hash or Array of “select”-type variations, depending on the value of the ‘group_by_component` option.
42 43 44 |
# File 'lib/docks/containers/demo_container.rb', line 42 def select_variations( = {}) variations_of_type(Docks::Types::Demo::SELECT, ) end |