Class: Sass::Repl

Inherits:
Object show all
Defined in:
/var/www/haml-pages/.haml/lib/sass/repl.rb

Overview

Runs a SassScript read-eval-print loop. It presents a prompt on the terminal, reads in SassScript expressions, evaluates them, and prints the result.

Instance Method Summary

Constructor Details

- (Repl) initialize(options = {})

A new instance of Repl

Parameters:

  • ({Symbol => Object}) options (defaults to: {}) — An options hash.


11
12
13
# File '/var/www/haml-pages/.haml/lib/sass/repl.rb', line 11

def initialize(options = {})
  @options = options
end

Instance Method Details

- run

Starts the read-eval-print loop.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File '/var/www/haml-pages/.haml/lib/sass/repl.rb', line 16

def run
  environment = Environment.new
  environment.set_var('important', Script::String.new('!important'))
  @line = 0
  loop do
    @line += 1
    unless text = Readline.readline('>> ')
      puts
      return
    end

    Readline::HISTORY << text
    parse_input(environment, text)
  end
end