This file contains 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
# From http://blog.boochtek.com/2015/02/23/hexagonal-rails-controllers | |
class OrderController < ApplicationController | |
def index | |
interactor.on(:display) { |orders| render orders } | |
interactor.list | |
end | |
def show | |
interactor.on(:display) { |order| render order } |
This file contains 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 CreditInclusionType < IDontCare | |
Null = Object.new | |
class << Null | |
def by_term? | |
false | |
end | |
def by_credits? | |
false |
This file contains 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 << Silent = Object.new | |
def heard?(other) | |
other.empty? | |
end | |
def respond | |
"Fine. Be that way." | |
end | |
end |
This file contains 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 ApiEndpoint | |
def endpoint_for(id) | |
id.constantize.eval do | |
has_many self.underscore, :through => :api_objects, :source => :endpoint, :source_type => self.to_s | |
end | |
has_many :api_objects, :as => :endpoint | |
has_many id, :through => :api_objects | |
end | |
end |
This file contains 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
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9 | |
# Don't load rspec if running "rake gems:*" | |
unless ARGV.any? {|a| a =~ /^gems/} | |
begin | |
require 'spec/rake/spectask' | |
rescue MissingSourceFile | |
module Spec | |
module Rake |
This file contains 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
# tokens/termials | |
EQ | |
LBRACE | |
RBRACE | |
LPAREN | |
RPAREN | |
DOT | |
COMMA | |
PIPE |