Skip to content

Instantly share code, notes, and snippets.

@colindean
Created July 29, 2016 03:34
Show Gist options
  • Save colindean/399540d46cb96fe5cc6f5647f9461115 to your computer and use it in GitHub Desktop.
Save colindean/399540d46cb96fe5cc6f5647f9461115 to your computer and use it in GitHub Desktop.
DSL for building contracts using mixins and inheritance
class AbstractionsContractBase < ContractBase
include AbstractionsContract::Clauses::CodeOfConduct
include AbstractionsContract::Clauses::LiabilityDisclaimer
end
class AbstractionsBronzeContract < AbstractionsContractBase
include AbstractionsContract::Clauses::PaidSponsorship
min_payment 10_000.USD
include AbstractionsContract::Clauses::Perks::WebsiteLogo
include AbstractionsContract::Clauses::Perks::Table
include AbstractionsContract::Clauses::Perks::Whatever
end
sponsor_contract = AbstractionsBronzeContract.new name: 'Spacely Sprockets', payment: 11_000.USD, signatory: 'Cosmo Spacely'
File.open("spacely_sprockets_contract.pdf", 'w') { |f| f.write sponsor_contract.to_pdf }
sponsor_contract_with_amendments = AbstractionsBronzeContract.new name: 'Cogswell Cogs', payment: 11_001.USD, signatory: 'W.C. Cogswell', amendments: <-AMENDMENTS_END
Sponsor must always been given the option to provide more support than Spacely Sprockets.
Sponsor will be permitted to deliver a two minute opening address before the headlining session each day.
AMENDMENTS_END
File.open("cogswell_cogs_contract.pdf", 'w') { |f| f.write sponsor_contract_with_amendments.to_pdf }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment