module Trip
module Controls
class AttendsTripOffer
def initialize(request)
Validator.validate!(request)
@user = FacebookUserFetcher.get(request.access_token)
@trip_offer = Repositories::TripOffer.find_by_id(request.trip_offer_id)
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 Post | |
class Mapper | |
include SomeMapper | |
def self.find(id) | |
post = super | |
if post.published_at | |
PublishedPost.new(post) | |
else | |
Draft.new(post) |
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
# I'm trying to follow advice from "Keynote: Architecture the Lost Years by Robert Martin" | |
# ( https://www.youtube.com/watch?v=WpkDN78P884 ) | |
# | |
# I created a separate gem for my domain logic. It has entities and interactors. | |
# | |
# An example of a rails controller: | |
class CommentsController < ApplicationController | |
include MyApp::Interactors | |
def create |
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
module Trip | |
module Controls | |
class AttendsTripOffer | |
def initialize(request) | |
Validator.validate!(request) | |
@user = FacebookUserFetcher.get(request.access_token) | |
@trip_offer = Repositories::TripOffer.find_by_id(request.trip_offer_id) | |
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
#!/bin/bash | |
START=bff040e58fa3f00a5c8caada4d1c00718d2810f2 | |
function filesChanged() { | |
prev=$START | |
revs=`git rev-list $START..HEAD --no-merges` | |
for rev in $revs; do | |
changed=`git diff --name-only $prev $rev --diff-filter=M` |
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
require "dm-mapper" | |
require "data_mapper/engine/arel" | |
DM = DataMapper::Environment.new | |
DM.engines[:arel] = DataMapper::Engine::Arel::Engine.new("sqlite3:/db/development.sqlite3") | |
require "virtus" | |
class Variant | |
include DataMapper::Model |
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
module Admin | |
class CategoriesController < BaseController | |
def new | |
@form = CategoryForm.new | |
end | |
def create | |
@form = CategoryForm.new(params[:category]) | |
if @form.valid? |
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
require "virtus" | |
module Bitbot | |
module Live | |
class Depth | |
include Virtus | |
attribute :price, Price | |
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 MakesBookingPayment | |
def initialize(booking, payment_details) | |
@booking = booking | |
@payment_details = payment_details | |
end | |
def pay! | |
response = process_payment | |
Transaction.record_purchase(@booking, response) |
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
:!mutant -r ./spec/spec_helper.rb --rspec-dm2 ::Inflecto\.underscore | |
Spec file(s): "spec/unit//class_methods/underscore_spec.rb" not found for Inflecto.underscore:/Users/indrek/inflecto/lib/inflecto.rb:43:9f2af | |
... | |
... | |
Took: (0.05s) | |
subjects: 1 | |
mutations: 52 | |
noop_fails: 0 |