Last active
December 16, 2015 01:29
-
-
Save kinopyo/5355179 to your computer and use it in GitHub Desktop.
memo on DestroyAllSoftware screencasts
- override Struct initialize
- alias_method :allow_export?, :allow_export
This file contains hidden or 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 Subscription < Struct.new(:id, :type) | |
attr_reader :allow_export | |
alias_method :allow_export?, :allow_export | |
def initialize(id, type) | |
super | |
@allow_export = id.present? && type == 'business' | |
end | |
end |
This file contains hidden or 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 Subscription < Struct.new(:id, :type) | |
def active? | |
id.present? | |
end | |
def allow_export? | |
active? && type == 'business' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment