class MatterCompiler::NamedBlueprintNode

Blueprint AST node with name and description associated

@attr name [String] name of the node @attr description [String] description of the node

@abstract

Attributes

description[RW]
name[RW]

Public Instance Methods

ensure_description_newlines(buffer) click to toggle source

Ensure the input string buffer ends with two newlines.

@param buffer [String] a buffer to check

If the buffer does not ends with two newlines the newlines are added.
# File lib/matter_compiler/blueprint.rb, line 56
def ensure_description_newlines(buffer)
  return if description.blank?

  if description[-1, 1] != "\n"
    buffer << "\n\n"
  elsif description.length > 1 && description[-2, 1] != "\n"
    buffer << "\n"
  end    
end
load_ast!(ast) click to toggle source
# File lib/matter_compiler/blueprint.rb, line 47
def load_ast!(ast)
  @name = ast[:name]
  @description = ast[:description]
end