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 Products | |
# What if we want to differ the content between iOS and Web? | |
class IndexResource | |
def initialize(product_presenters, content_type) | |
@product_presenters = product_presenters | |
@content_type = content_type | |
end | |
def render(rendering_engine = RenderingEngine) | |
rendering_engine.render(partial_path, product_presenters: product_presenters) |
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
Dir.glob("**/*.rb").each do |file| | |
`vim -c "set ts=4 sts=4 noet|retab!|set ts=2 sts=2 et|retab|wq" #{file}` | |
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
defmodule EmailValidation do | |
def validate(email) do | |
email_validation_result = {:ok, email} | |
check_for_validity(email_validation_result) | |
|> check_if_email_taken | |
end | |
defp check_for_validity({:ok, email}) do | |
case check_against_regex(email) do |
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
defmodule Success do | |
@type t :: %Success{value: any} | |
defstruct value: nil | |
end | |
defmodule Failure do | |
@type t :: %Failure{value: any, reason: String.t} | |
defstruct value: nil, reason: nil | |
end |
OlderNewer