Module: Psychgus::Stylables::SeqFlowStylable

Includes:
StyleStylable
Included in:
Psychgus::Stylers::FlowStyler, Psychgus::Stylers::SeqFlowStyler
Defined in:
lib/psychgus/stylables.rb

Overview

A FLOW style changer for Sequences only.

Constant Summary

Constants included from Psychgus::Styler

Psychgus::Styler::EMPTY

Instance Attribute Summary

Attributes included from StyleStylable

#min_level, #new_style

Instance Method Summary collapse

Methods included from StyleStylable

#change_style

Methods included from Psychgus::Styler

#style, #style_alias, #style_document, #style_mapping, #style_scalar, #style_stream

Instance Method Details

#initialize(min_level = 0, new_style: nil, **kargs) ⇒ Object

max_level is not defined because a parent's style will override all of its children.

If new_style is nil (the default), then Psychgus::SEQUENCE_FLOW will be used.

Parameters:

  • min_level (Integer) (defaults to: 0)

    the minimum level (inclusive) to style

  • new_style (Integer) (defaults to: nil)

    the new style to set the nodes to

  • kargs (Hash)

    capture extra keyword args, so no error for undefined args

Since:

  • 1.2.0



257
258
259
260
261
# File 'lib/psychgus/stylables.rb', line 257

def initialize(*)
  super
  
  @new_style = SEQUENCE_FLOW if @new_style.nil?()
end

#style_sequence(sniffer, node) ⇒ Object

Change the style of a Sequence to FLOW (or to the value of Psychgus::Stylables::StyleStylable#new_style) if it is >= Psychgus::Stylables::StyleStylable#min_level.



268
269
270
# File 'lib/psychgus/stylables.rb', line 268

def style_sequence(sniffer,node)
  change_style(sniffer,node)
end