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 TeamMember | |
def initialize(person, team) | |
add_person(person) | |
add_team(team) | |
end | |
def add_person(person) | |
test_add_person(person) | |
do_add_person(person) |
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
{ true => -> { self.respond_with @post, @comment }, | |
false => -> { self.xms_error @comment } | |
}[@comment.save].call | |
{ success: 'alert-success', | |
error: 'alert-danger', | |
notice: 'alert-info', | |
warn: 'alert-warning' }[flash[:type]] |
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 Order < ActiveRecord::Base | |
has_many :payments | |
scope :active, -> { where(:active, true) } | |
def self.fetch(id) | |
find(id) | |
end | |
# @stereotype business_rule |
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 Foo | |
def bar | |
baz = Class.new do | |
def qux | |
"QUX" | |
end | |
end | |
baz.new | |
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
defmodule Streamers do | |
defmodule M3U8 do | |
defstruct [:program_id, :path, :bandwidth] | |
end | |
@doc """ | |
Find streaming index file in a given directory | |
""" | |
def find_index(directory) do | |
files = Path.join(directory, "*.m3u8") |
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 Address < ActiveRecord::Base | |
belongs_to :person | |
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
x = [1, 2, 3] | |
class Foo | |
def initialize(bar) | |
@bar = bar | |
end | |
def greeting | |
"Hello #{bar}" | |
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
def create | |
uploaded_file = params[:batch_payouts_csv] | |
unless valid_file_type?(uploaded_file) | |
render json: {"error_message" => I18n.t("merchant.messages.errors.invalid_file_type")}, status: 400 | |
return | |
end | |
uploaded_csv_file = Batch::CsvFile.new(uploaded_file.path) | |
unless uploaded_csv_file.valid_size? |
From: http://thesecretsquad.wordpress.com/2014/10/25/dazed-and-confuzzled/
What should these messages look like? The basis for my analysis is:
An object should send messages to client-specific interfaces. This means an object should send messages that are meaningful to itself, and interfacing objects should have only those messages available.
OlderNewer