Class: Nanoc::Core::ActionSequence
- Inherits:
-
Object
- Object
- Nanoc::Core::ActionSequence
- Includes:
- Enumerable, MemoWise
- Defined in:
- lib/nanoc/core/action_sequence.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
Instance Method Summary collapse
-
#[](idx) ⇒ Object
contract Numeric => C::Maybe.
-
#each ⇒ Object
contract C::Func[Nanoc::Core::ProcessingAction => C::Any] => self.
-
#initialize(actions: []) ⇒ ActionSequence
constructor
A new instance of ActionSequence.
-
#map ⇒ Object
contract C::Func[Nanoc::Core::ProcessingAction => C::Any] => self.
-
#paths ⇒ Object
contract C::None => Array.
- #serialize ⇒ Object
-
#serialize_uncached ⇒ Object
contract C::None => Array.
-
#size ⇒ Object
contract C::None => Numeric.
-
#snapshot_actions ⇒ Object
contract C::None => C::ArrayOf.
Constructor Details
#initialize(actions: []) ⇒ ActionSequence
Returns a new instance of ActionSequence.
12 13 14 |
# File 'lib/nanoc/core/action_sequence.rb', line 12 def initialize(actions: []) @actions = actions end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
10 11 12 |
# File 'lib/nanoc/core/action_sequence.rb', line 10 def actions @actions end |
Instance Method Details
#[](idx) ⇒ Object
contract Numeric => C::Maybe
22 23 24 |
# File 'lib/nanoc/core/action_sequence.rb', line 22 def [](idx) @actions[idx] end |
#each ⇒ Object
contract C::Func[Nanoc::Core::ProcessingAction => C::Any] => self
47 48 49 50 |
# File 'lib/nanoc/core/action_sequence.rb', line 47 def each(&) @actions.each(&) self end |
#map ⇒ Object
contract C::Func[Nanoc::Core::ProcessingAction => C::Any] => self
53 54 55 56 57 |
# File 'lib/nanoc/core/action_sequence.rb', line 53 def map(&) self.class.new( actions: @actions.map(&), ) end |
#paths ⇒ Object
contract C::None => Array
32 33 34 |
# File 'lib/nanoc/core/action_sequence.rb', line 32 def paths snapshot_actions.map { |a| [a.snapshot_names, a.paths] } end |
#serialize ⇒ Object
36 37 38 |
# File 'lib/nanoc/core/action_sequence.rb', line 36 def serialize serialize_uncached end |
#serialize_uncached ⇒ Object
contract C::None => Array
42 43 44 |
# File 'lib/nanoc/core/action_sequence.rb', line 42 def serialize_uncached to_a.map(&:serialize) end |
#size ⇒ Object
contract C::None => Numeric
17 18 19 |
# File 'lib/nanoc/core/action_sequence.rb', line 17 def size @actions.size end |
#snapshot_actions ⇒ Object
contract C::None => C::ArrayOf
27 28 29 |
# File 'lib/nanoc/core/action_sequence.rb', line 27 def snapshot_actions @actions.select { |a| a.is_a?(Nanoc::Core::ProcessingActions::Snapshot) } end |