Skip to content

Instantly share code, notes, and snippets.

@plexus
Created July 5, 2013 13:03
Show Gist options
  • Save plexus/5934403 to your computer and use it in GitHub Desktop.
Save plexus/5934403 to your computer and use it in GitHub Desktop.
class Note
attr_accessor :message
def initialize(attrs)
@message = attrs[:message]
end
def save
Note.all << self
end
def self.all
@all ||= []
end
end
class ShoesApp ; include Shoes
url '/', :index
def index
para 'Say something...'
flow do
@note = edit_line
button 'OK' do
Note.new(:message => @note.text).save
@note.text = ''
@@result.replace get_notes # error
end
end
@@result = para get_notes # Works fine
end
def get_notes
Note.all.map(&:message).join("\n")
end
end
Shoes.app :title => 'Notes', :width => 260, :height => 350
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment