Created
December 15, 2013 09:57
-
-
Save adambeynon/7970981 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 User < Vienna::Model | |
attributes :first_name, :last_name | |
end | |
user = User.new | |
first = Frappuccino::Stream.new(user).capture(:changed_first_name) | |
last = Frappuccino::Stream.new(user).capture(:changed_last_name) | |
# last name is any change to first or last name | |
last_name = first.merge(last).map { "#{user.first_name} #{user.last_name}" } | |
user.first_name = "Ford" | |
last_name.now # => "Ford " | |
user.last_name = "Prefect" | |
last_name.now # => "Ford Prefect" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment