Class: Lisp::Format::Directives::Literal

Inherits:
String show all
Defined in:
lib/carat/lisp-format.rb

Overview

Represents a string literal in the input format. This is used for combining running lengths of characters with a single pseudo-directive.

Instance Method Summary collapse

Methods inherited from String

#apply_snapshot, #take_snapshot

Instance Method Details

#execute(state) ⇒ Object

Outputs the string literal this instance represents to the output stream.



504
505
506
# File 'lib/carat/lisp-format.rb', line 504

def execute(state)
  state.output self
end

#join(other) ⇒ Object

If the following directive is also a Literal, its contents is simply added to this ones, and returns self. Otherwise the other directive is returned.



511
512
513
# File 'lib/carat/lisp-format.rb', line 511

def join(other)
  other.is_a?(Literal) ? self << other : other
end