Created
July 5, 2013 13:03
-
-
Save plexus/5934403 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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