Skip to content

Instantly share code, notes, and snippets.

@philiplambok
Created November 23, 2019 07:18
Show Gist options
  • Save philiplambok/4945c0ca9d427ab23f374401dc401b49 to your computer and use it in GitHub Desktop.
Save philiplambok/4945c0ca9d427ab23f374401dc401b49 to your computer and use it in GitHub Desktop.

SimpleBuilder

Make paramameter more cute than your waifu >//<

# app/builders/date.rb

class Date
  include SimpleBuilder

  attributes :day, :string
  attributes :month, :string
  attributes :year, :integer
end

# main program
def main
  user = User.find_by(name: 'iyan')
  date = Date.new
             .with_day('Senin')
             .with_month('Mei')
             .with_year(2018)
  user.process_payroll_on(date)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment