Skip to content

Instantly share code, notes, and snippets.

@brett-richardson
Created March 13, 2014 20:35
Show Gist options
  • Save brett-richardson/9536451 to your computer and use it in GitHub Desktop.
Save brett-richardson/9536451 to your computer and use it in GitHub Desktop.
require 'phony'
Phone = Struct.new(:value) do
alias_method :value, :to_s
def initialize(value)
@value = value.to_s
end
def plausible?
Phony.plausible? @value
end
end
class User
composed_of :phone, class_name: 'Phone',
mapping: %w(phone value), allow_nil: true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment