Class: Herb::AST::RubyRenderKeywordsNode
- Includes:
- Colors
- Defined in:
- lib/herb/ast/nodes.rb,
ext/herb/nodes.c
Overview
: type serialized_ruby_render_keywords_node = { | partial: Herb::Token?, | template_path: Herb::Token?, | layout: Herb::Token?, | file: Herb::Token?, | inline_template: Herb::Token?, | body: Herb::Token?, | plain: Herb::Token?, | html: Herb::Token?, | renderable: Herb::Token?, | collection: Herb::Token?, | object: Herb::Token?, | as_name: Herb::Token?, | spacer_template: Herb::Token?, | formats: Herb::Token?, | variants: Herb::Token?, | handlers: Herb::Token?, | content_type: Herb::Token?, | locals: Array?, | }
Constant Summary
Constants included from Colors
Colors::CLEAR_SCREEN, Colors::HIDE_CURSOR, Colors::SHOW_CURSOR
Instance Attribute Summary collapse
-
#as_name ⇒ Object
readonly
: Herb::Token?.
-
#body ⇒ Object
readonly
: Herb::Token?.
-
#collection ⇒ Object
readonly
: Herb::Token?.
-
#content_type ⇒ Object
readonly
: Herb::Token?.
-
#file ⇒ Object
readonly
: Herb::Token?.
-
#formats ⇒ Object
readonly
: Herb::Token?.
-
#handlers ⇒ Object
readonly
: Herb::Token?.
-
#html ⇒ Object
readonly
: Herb::Token?.
-
#inline_template ⇒ Object
readonly
: Herb::Token?.
-
#layout ⇒ Object
readonly
: Herb::Token?.
-
#locals ⇒ Object
readonly
: Array?.
-
#object ⇒ Object
readonly
: Herb::Token?.
-
#partial ⇒ Object
readonly
: Herb::Token?.
-
#plain ⇒ Object
readonly
: Herb::Token?.
-
#renderable ⇒ Object
readonly
: Herb::Token?.
-
#spacer_template ⇒ Object
readonly
: Herb::Token?.
-
#template_path ⇒ Object
readonly
: Herb::Token?.
-
#variants ⇒ Object
readonly
: Herb::Token?.
Attributes inherited from Node
#errors, #location, #source, #type
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
: (Visitor) -> void.
-
#child_nodes ⇒ Object
: () -> Array.
-
#compact_child_nodes ⇒ Object
: () -> Array.
- #initialize(type, location, errors, partial, template_path, layout, file, inline_template, body, plain, html, renderable, collection, object, as_name, spacer_template, formats, variants, handlers, content_type, locals) ⇒ RubyRenderKeywordsNode constructor
-
#inspect ⇒ Object
: () -> String.
-
#to_hash ⇒ Object
: () -> serialized_ruby_render_keywords_node.
-
#tree_inspect(indent: 0, depth: 0, depth_limit: 10) ⇒ Object
: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String.
Methods included from Colors
bold, bright_magenta, cyan, dimmed, enabled?, fg, fg_bg, green, magenta, red, white, yellow
Methods inherited from Node
#class_name, #inspect_array, #inspect_errors, #node_name, #recursive_errors, #to_json
Constructor Details
#initialize(type, location, errors, partial, template_path, layout, file, inline_template, body, plain, html, renderable, collection, object, as_name, spacer_template, formats, variants, handlers, content_type, locals) ⇒ RubyRenderKeywordsNode
3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 |
# File 'lib/herb/ast/nodes.rb', line 3628 def initialize(type, location, errors, partial, template_path, layout, file, inline_template, body, plain, html, renderable, collection, object, as_name, spacer_template, formats, variants, handlers, content_type, locals) super(type, location, errors) @partial = partial @template_path = template_path @layout = layout @file = file @inline_template = inline_template @body = body @plain = plain @html = html @renderable = renderable @collection = collection @object = object @as_name = as_name @spacer_template = spacer_template @formats = formats @variants = variants @handlers = handlers @content_type = content_type @locals = locals end |
Instance Attribute Details
#as_name ⇒ Object (readonly)
: Herb::Token?
3619 3620 3621 |
# File 'lib/herb/ast/nodes.rb', line 3619 def as_name @as_name end |
#body ⇒ Object (readonly)
: Herb::Token?
3613 3614 3615 |
# File 'lib/herb/ast/nodes.rb', line 3613 def body @body end |
#collection ⇒ Object (readonly)
: Herb::Token?
3617 3618 3619 |
# File 'lib/herb/ast/nodes.rb', line 3617 def collection @collection end |
#content_type ⇒ Object (readonly)
: Herb::Token?
3624 3625 3626 |
# File 'lib/herb/ast/nodes.rb', line 3624 def content_type @content_type end |
#file ⇒ Object (readonly)
: Herb::Token?
3611 3612 3613 |
# File 'lib/herb/ast/nodes.rb', line 3611 def file @file end |
#formats ⇒ Object (readonly)
: Herb::Token?
3621 3622 3623 |
# File 'lib/herb/ast/nodes.rb', line 3621 def formats @formats end |
#handlers ⇒ Object (readonly)
: Herb::Token?
3623 3624 3625 |
# File 'lib/herb/ast/nodes.rb', line 3623 def handlers @handlers end |
#html ⇒ Object (readonly)
: Herb::Token?
3615 3616 3617 |
# File 'lib/herb/ast/nodes.rb', line 3615 def html @html end |
#inline_template ⇒ Object (readonly)
: Herb::Token?
3612 3613 3614 |
# File 'lib/herb/ast/nodes.rb', line 3612 def inline_template @inline_template end |
#layout ⇒ Object (readonly)
: Herb::Token?
3610 3611 3612 |
# File 'lib/herb/ast/nodes.rb', line 3610 def layout @layout end |
#locals ⇒ Object (readonly)
: Array?
3625 3626 3627 |
# File 'lib/herb/ast/nodes.rb', line 3625 def locals @locals end |
#object ⇒ Object (readonly)
: Herb::Token?
3618 3619 3620 |
# File 'lib/herb/ast/nodes.rb', line 3618 def object @object end |
#partial ⇒ Object (readonly)
: Herb::Token?
3608 3609 3610 |
# File 'lib/herb/ast/nodes.rb', line 3608 def partial @partial end |
#plain ⇒ Object (readonly)
: Herb::Token?
3614 3615 3616 |
# File 'lib/herb/ast/nodes.rb', line 3614 def plain @plain end |
#renderable ⇒ Object (readonly)
: Herb::Token?
3616 3617 3618 |
# File 'lib/herb/ast/nodes.rb', line 3616 def renderable @renderable end |
#spacer_template ⇒ Object (readonly)
: Herb::Token?
3620 3621 3622 |
# File 'lib/herb/ast/nodes.rb', line 3620 def spacer_template @spacer_template end |
#template_path ⇒ Object (readonly)
: Herb::Token?
3609 3610 3611 |
# File 'lib/herb/ast/nodes.rb', line 3609 def template_path @template_path end |
#variants ⇒ Object (readonly)
: Herb::Token?
3622 3623 3624 |
# File 'lib/herb/ast/nodes.rb', line 3622 def variants @variants end |
Instance Method Details
#accept(visitor) ⇒ Object
: (Visitor) -> void
3675 3676 3677 |
# File 'lib/herb/ast/nodes.rb', line 3675 def accept(visitor) visitor.visit_ruby_render_keywords_node(self) end |
#child_nodes ⇒ Object
: () -> Array
3680 3681 3682 |
# File 'lib/herb/ast/nodes.rb', line 3680 def child_nodes [*(locals || [])] end |
#compact_child_nodes ⇒ Object
: () -> Array
3685 3686 3687 |
# File 'lib/herb/ast/nodes.rb', line 3685 def compact_child_nodes child_nodes.compact end |
#inspect ⇒ Object
: () -> String
3690 3691 3692 |
# File 'lib/herb/ast/nodes.rb', line 3690 def inspect tree_inspect.rstrip.gsub(/\s+$/, "") end |
#to_hash ⇒ Object
: () -> serialized_ruby_render_keywords_node
3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 |
# File 'lib/herb/ast/nodes.rb', line 3651 def to_hash super.merge({ partial: partial, template_path: template_path, layout: layout, file: file, inline_template: inline_template, body: body, plain: plain, html: html, renderable: renderable, collection: collection, object: object, as_name: as_name, spacer_template: spacer_template, formats: formats, variants: variants, handlers: handlers, content_type: content_type, locals: locals, }) #: Herb::serialized_ruby_render_keywords_node end |
#tree_inspect(indent: 0, depth: 0, depth_limit: 10) ⇒ Object
: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 |
# File 'lib/herb/ast/nodes.rb', line 3695 def tree_inspect(indent: 0, depth: 0, depth_limit: 10) output = +"" output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location.tree_inspect})")}") output += "\n" if depth >= depth_limit output += dimmed("└── [depth limit reached ...]\n\n") return output.gsub(/^/, " " * indent) end output += inspect_errors(prefix: "│ ") output += white("├── partial: ") output += partial ? partial.tree_inspect : magenta("∅") output += "\n" output += white("├── template_path: ") output += template_path ? template_path.tree_inspect : magenta("∅") output += "\n" output += white("├── layout: ") output += layout ? layout.tree_inspect : magenta("∅") output += "\n" output += white("├── file: ") output += file ? file.tree_inspect : magenta("∅") output += "\n" output += white("├── inline_template: ") output += inline_template ? inline_template.tree_inspect : magenta("∅") output += "\n" output += white("├── body: ") output += body ? body.tree_inspect : magenta("∅") output += "\n" output += white("├── plain: ") output += plain ? plain.tree_inspect : magenta("∅") output += "\n" output += white("├── html: ") output += html ? html.tree_inspect : magenta("∅") output += "\n" output += white("├── renderable: ") output += renderable ? renderable.tree_inspect : magenta("∅") output += "\n" output += white("├── collection: ") output += collection ? collection.tree_inspect : magenta("∅") output += "\n" output += white("├── object: ") output += object ? object.tree_inspect : magenta("∅") output += "\n" output += white("├── as_name: ") output += as_name ? as_name.tree_inspect : magenta("∅") output += "\n" output += white("├── spacer_template: ") output += spacer_template ? spacer_template.tree_inspect : magenta("∅") output += "\n" output += white("├── formats: ") output += formats ? formats.tree_inspect : magenta("∅") output += "\n" output += white("├── variants: ") output += variants ? variants.tree_inspect : magenta("∅") output += "\n" output += white("├── handlers: ") output += handlers ? handlers.tree_inspect : magenta("∅") output += "\n" output += white("├── content_type: ") output += content_type ? content_type.tree_inspect : magenta("∅") output += "\n" output += white("└── locals: ") output += inspect_array(locals, prefix: " ", indent: indent, depth: depth + 1, depth_limit: depth_limit) output += "\n" output.gsub(/^/, " " * indent) end |