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 UserSearcher | |
def self.call(params = {}) | |
scope = ::User.active | |
# by id | |
scope = scope.find(params['id']).to_a if params['id'].present? | |
# simple fields | |
%w[first_name last_name email city].each do |item| | |
next unless params[item].present? |
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
# model | |
class Post | |
include Neo4j::ActiveNode | |
include Neo4j::Timestamps | |
scope :published, -> { where(published: true) } | |
def self.searching(search_params) | |
result = Post.published | |
# relations |
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 ForgottenPasswordService | |
def initialize(user_email) | |
@user_email = user_email | |
@user = nil | |
end | |
def perform | |
find_user && generate_token && send_email | |
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
module Visitable | |
def accept(visitor) | |
raise 'does not implement error' | |
end | |
end | |
# class that accept any visitor | |
class User < ApplicationRecord | |
include Visitable |
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 AbstractState | |
def initialize(content) | |
@content = content | |
end | |
def status | |
raise 'does not implement error' | |
end | |
def publish |
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 LogHandler | |
attr_reader :successor | |
def initialize(successor = nil) | |
@successor = successor | |
end | |
def process(log_item) | |
if accept(log_item) |
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
example_200 = { | |
path: '/admin/rubrics', | |
time: '2018-03-02 12:10:34 +0300', | |
http_status: '200', | |
http_method: 'POST', | |
parameters: {"rubric"=>{"title"=>"111", "locator"=>"111"}}, | |
processing: { | |
by: 'Admin::RubricsController#create', | |
as: 'JS' | |
}, |
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
# library for generate xls-file | |
module RubyXLS | |
# a lot of code | |
end | |
# class that consis information about user | |
class User | |
# a lot of code | |
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
[ | |
#<VariableAssign | |
@name=:"other-color", | |
@expression= #<VirtualString @value="red">>, | |
#<VariableAssign | |
@name=:main_color, | |
@expression= #<VirtualString @value="green">>, | |
#<Selector | |
@name="div", | |
@declaration=[ |
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
$other-color: red; | |
$main_color: green; | |
div { | |
color: $main_color; | |
p { | |
color: $main_color; | |
span { | |
font-size: 9px; | |
} |