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 RematchEnrichingResults do | |
alias HGForce.Schemas.Integration | |
alias HGForce.Repo | |
alias HGForce.Schemas.IntegrationOAuthToken | |
alias SFDCEx.RestAPI | |
import Ecto.Query | |
def call(data_category, integration_ids) do |
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
# spec/dummy/app/models/color.rb | |
class Color < ActiveRecord::Base | |
def hex | |
MyGem.rgb_to_hex(red, green, blue) | |
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
# spec/spec_helper.rb | |
# ... | |
require File.expand_path('../spec/dummy/config/environment.rb', __dir__) | |
ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '../../../spec/dummy' | |
require 'rspec/rails' | |
# ... |
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
# my-gem.gemspec | |
# ... | |
Gem::Specification.new do |spec| | |
# ... | |
spec.add_development_dependency 'rspec-rails' | |
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
# spec/dummy/config/application.rb | |
# ... | |
require 'my-gem' | |
module Dummy | |
class Application < Rails::Application | |
# ... |
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
array = [[0, 1], [2, 3]] | |
array.each { puts "_1: #{_1}, _2: #{_2}" } | |
# _1: 0, _2: 1 | |
# _1: 2, _2: 3 | |
# => [[0, 1], [2, 3]] | |
array.map { |even, odd| [even, odd].sum { _1 } } | |
# => [1, 5] | |
array.map { [_1, _2].sum { _1 } } |
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
SaleLineItem.all | |
.map { [mult_it!(_1), add_it!(_1)] } | |
.map { _1 + _2 } |
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
SaleLineItem.all | |
.map { |s| [mult_it!(s), add_it!(s)] } | |
.map { |m, a| m + a } |
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
SaleLineItem.all | |
.map { |sli| [mult_it!(sli), add_it!(sli)] } | |
.map { |msli, asli| msli + asli } |
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
SaleLineItem.all | |
.map { |sale_line_item| [mult_it!(sale_line_item), add_it!(sale_line_item)] } | |
.map { |multiplied_sale_line_item, added_sale_line_item| multiplied_sale_line_item + added_sale_line_item } |
NewerOlder