Skip to content

Instantly share code, notes, and snippets.

@kinopyo
Last active December 16, 2015 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kinopyo/5355179 to your computer and use it in GitHub Desktop.
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
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
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