Skip to content

Instantly share code, notes, and snippets.

module Accounting
module Adapters
class ClientOrder < Adapter
alias_attribute :ledger, :invoice
def initialize(order)
raise ArgumentError, 'ClientOrder must adapt an order ' unless order.is_a? Order
super(order)
end
class JrClientGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
def self.process_resource(resource_klass)
attributes = resource_klass._attributes.clone
model_klass = resource_klass._model_name.safe_constantize
# We only want the type value from each column, and we also need
# to convert the key to a symbol, if you're using non AR records to back
# your JR model, its not going to have an attribute hash, so lets just
function ManifestNavigator({navigation, route}) {
const params = route ? route.params : {};
return (
<Stack.Navigator>
<Stack.Screen
name="Home"
component={Home}
options={{
headerStyle: {
module Ordering
module Commands
module States
class Cancel < ::Commands::Command
dependency :find_order, ::Queries::Id.klass(Order)
dependency :free_utilization, RestaurantCapacities::FreeUtilizationService
dependency :cancel_sync, ThirdPartyLogistics::CancelSync
dependency :emit, ::Events::Emitter
web: node index.js
-- Turns a nested array of json into a record set that we can join into
-- The value of the column in question is:
-- {"client_discounts": [{"code": 4846, "description": "Discount - AM"}, {"code": 4840, "description": "Discount - BD"}, {"code": 4836, "description": "Discount - CE"}, {"code": 4846, "description": "Discount - Cutlery"}, {"code": 4832, "description": "Discount - DE"}, {"code": 4835, "description": "Discount - Delivery Fees"}, {"code": 4831, "description": "Discount - FE"}, {"code": 4837, "description": "Discount - LL"}, {"code": 4842, "description": "Discount - Marketing Promos"}, {"code": 4852, "description": "Discount - Missing Items"}, {"code": 4833, "description": "Discount - RE"}, {"code": 4847, "description": "Delivery Service Fee"}, {"code": 4838, "description": "Discount - SOW"}, {"code": 4841, "description": "Discount - Sponsorship"}, {"code": 4844, "description": "Discount - KA"}, {"code": 4843, "description": "Discount - TE"}, {"code": 4834, "description": "Discount - VFH Delivery"},
# == Schema Information
#
# Table name: accounting_ledger_items
#
# id :integer not null, primary key
# sender_type :string
# sender_id :integer
# recipient_type :string
# recipient_id :integer
# type :string
describe FooCommand do
it 'sets the name of and saves bar' do
# setup
foo_command = FooCommand.as_subject
# store is wired onto every test, and shared by the DAO class Save / Find etc.
store.put(Bar.new(id: 123, name: 'old_name'))
#exercise
example
example