Class: Pieces::Listener

Inherits:
Object
  • Object
show all
Defined in:
lib/pieces/listener.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Listener

Returns a new instance of Listener.



5
6
7
8
# File 'lib/pieces/listener.rb', line 5

def initialize(config = {})
  @path = config[:path] || Dir.pwd
  build_pieces
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/pieces/listener.rb', line 3

def path
  @path
end

Instance Method Details

#listenObject



10
11
12
13
14
15
16
# File 'lib/pieces/listener.rb', line 10

def listen
  Listen.to("#{path}/config/", "#{path}/app/views/") do
    print "Rebuilding #{path}... "
    build_pieces
    puts 'done.'
  end.tap(&:start)
end