Skip to content

Instantly share code, notes, and snippets.

@krainboltgreene
Created January 10, 2013 10:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krainboltgreene/4501076 to your computer and use it in GitHub Desktop.
Save krainboltgreene/4501076 to your computer and use it in GitHub Desktop.
Account ->
attributes("name", "password")
setup: method(name, password) ->
name(name)
password(password)
tweets: method ->
Twitter get_tweets name: name, password: password
account: Account make(name: "krainboltgreene", password: "12341234")
window ->
stack(title: "Account") ->
row ->
"Username: {{account name}}"
row ->
"Mentions {{account mentions size}}"
stack(title: "Tweets") ->
tweets each -> tweet
row ->
"{{tweet user name}}: {{tweet message}}"
class Account
attr_accessor :name, :password
def initialize(name, password)
@name = name
@password = password
end
def tweets
Twitter.get_tweets name, password
end
end
account = Account.new "krainboltgreene", "12341234"
window do
stack title: "Account" do
row { "Username: #{account.name}"}
row { "Mentions: #{account.mentions.size}"}
end
stack title: "Tweets" do
account.tweets.each do |tweet|
row { "#{tweet.user.name}: #{tweet.message}" }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment