repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/method_definition_spec.rb
spec/lib/fasterer/method_definition_spec.rb
require 'spec_helper' describe Fasterer::MethodDefinition do let(:def_element) do Fasterer::Parser.parse(File.read(RSpec.root.join('support', 'method_definition', file_name))) end let(:method_definition) do Fasterer::MethodDefinition.new(def_element) end describe 'method with no arguments' do l...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/statistics_spec.rb
spec/lib/fasterer/statistics_spec.rb
require 'spec_helper' describe Fasterer::Statistics do let(:traverser_mock) do traverser = OpenStruct.new traverser.scannable_files = [] traverser.offenses_total_count = 0 traverser.parse_error_paths = [] traverser end let(:statistics) { Fasterer::Statistics.new(traverser_mock) } describe...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/config_spec.rb
spec/lib/fasterer/config_spec.rb
require 'spec_helper' require 'pathname' describe Fasterer::Config do let(:root) { Pathname.new("#{File.dirname(__FILE__)}/../../..").cleanpath } let(:expected_location) { "#{root}/.fasterer.yml" } describe '#file_location' do it 'returns a file that is in the current dir (eg the project root)' do exp...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/27_setter_vs_attr_writer_spec.rb
spec/lib/fasterer/analyzer/27_setter_vs_attr_writer_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '27_setter_vs_attr_writer.rb') } it 'should detect 2 setters' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:setter_vs_attr_writer].count).to e...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/24_gsub_vs_tr_spec.rb
spec/lib/fasterer/analyzer/24_gsub_vs_tr_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '24_gsub_vs_tr.rb') } it 'should detect gsub 4 times' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:gsub_vs_tr].count).to eq(2) end end
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/29_include_vs_cover_on_range_spec.rb
spec/lib/fasterer/analyzer/29_include_vs_cover_on_range_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) do RSpec.root.join('support', 'analyzer', '29_include_vs_cover_on_range.rb') end it 'should detect 3 include? method calls' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:include...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/12_select_first_vs_detect_spec.rb
spec/lib/fasterer/analyzer/12_select_first_vs_detect_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '12_select_first_vs_detect.rb') } it 'should detect sort once' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:select_first_vs_detect].count).to...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/08_for_loop_vs_each_spec.rb
spec/lib/fasterer/analyzer/08_for_loop_vs_each_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '08_for_loop_vs_each.rb') } it 'should detect a for loop' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:for_loop_vs_each].count).to eq(1) en...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/98_misc_spec.rb
spec/lib/fasterer/analyzer/98_misc_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '98_misc.rb') } it 'should detect gsub 4 times' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan end end
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/15_keys_each_vs_each_key_spec.rb
spec/lib/fasterer/analyzer/15_keys_each_vs_each_key_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '15_keys_each_vs_each_key.rb') } it 'should detect keys each 3 times' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:keys_each_vs_each_key].cou...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/09_each_with_index_vs_while_spec.rb
spec/lib/fasterer/analyzer/09_each_with_index_vs_while_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '09_each_with_index_vs_while.rb') } it 'should detect a for loop' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:each_with_index_vs_while].coun...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/18_block_vs_symbol_to_proc_spec.rb
spec/lib/fasterer/analyzer/18_block_vs_symbol_to_proc_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '18_block_vs_symbol_to_proc.rb') } it 'should block that could be called with symbol 9 times' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:bl...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/10_map_flatten_vs_flat_map_spec.rb
spec/lib/fasterer/analyzer/10_map_flatten_vs_flat_map_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '10_map_flatten_vs_flat_map.rb') } it 'should detect a map{}.flatten(1) ' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:map_flatten_vs_flat_ma...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/19_proc_call_vs_yield_spec.rb
spec/lib/fasterer/analyzer/19_proc_call_vs_yield_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '19_proc_call_vs_yield.rb') } it 'should detect sort once' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:proc_call_vs_yield].count).to eq(3) ...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/06_shuffle_first_vs_sample_spec.rb
spec/lib/fasterer/analyzer/06_shuffle_first_vs_sample_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '06_shuffle_first_vs_sample.rb') } it 'should detect a for loop' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:shuffle_first_vs_sample].count)...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/16_hash_merge_bang_vs_hash_brackets_spec.rb
spec/lib/fasterer/analyzer/16_hash_merge_bang_vs_hash_brackets_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '16_hash_merge_bang_vs_hash_brackets.rb') } it 'should detect keys each 3 times' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:hash_merge_bang...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/26_getter_vs_attr_reader_spec.rb
spec/lib/fasterer/analyzer/26_getter_vs_attr_reader_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '26_getter_vs_attr_reader.rb') } it 'should detect 2 getters' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:getter_vs_attr_reader].count).to e...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/14_fetch_with_argument_vs_block_spec.rb
spec/lib/fasterer/analyzer/14_fetch_with_argument_vs_block_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '14_fetch_with_argument_vs_block.rb') } it 'should detect keys fetch with argument once' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:fetch_w...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/11_reverse_each_vs_reverse_each_spec.rb
spec/lib/fasterer/analyzer/11_reverse_each_vs_reverse_each_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '11_reverse_each_vs_reverse_each.rb') } it 'should detect a for loop' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:reverse_each_vs_reverse_ea...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/25_select_last_vs_reverse_detect_spec.rb
spec/lib/fasterer/analyzer/25_select_last_vs_reverse_detect_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '25_select_last_vs_reverse_detect.rb') } it 'should detect select last once' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:select_last_vs_reve...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/13_sort_vs_sort_by_spec.rb
spec/lib/fasterer/analyzer/13_sort_vs_sort_by_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '13_sort_vs_sort_by.rb') } it 'should detect sort once' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:sort_vs_sort_by].count).to eq(1) end e...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/03_module_eval_spec.rb
spec/lib/fasterer/analyzer/03_module_eval_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '03_module_eval.rb') } it 'should detect module eval' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:module_eval].count).to eq(1) end end
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/02_rescue_vs_respond_to_spec.rb
spec/lib/fasterer/analyzer/02_rescue_vs_respond_to_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '02_rescue_vs_respond_to.rb') } it 'should detect rescue NoMethodError' do analyzer = Fasterer::Analyzer.new(test_file_path) analyzer.scan expect(analyzer.errors[:rescue_vs_respond_to].co...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/spec/lib/fasterer/analyzer/99_exceptional_files_spec.rb
spec/lib/fasterer/analyzer/99_exceptional_files_spec.rb
require 'spec_helper' describe Fasterer::Analyzer do let(:test_file_path) { RSpec.root.join('support', 'analyzer', '99_exceptional_files.rb') } it 'diacritics should not raise an error' do analyzer = Fasterer::Analyzer.new(test_file_path) expect { analyzer.scan }.not_to raise_error end end
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/lib/fasterer.rb
lib/fasterer.rb
require 'fasterer/version' require 'fasterer/analyzer' require 'fasterer/method_definition' module Fasterer # Your code goes here... end
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/lib/fasterer/rescue_call.rb
lib/fasterer/rescue_call.rb
module Fasterer class RescueCall attr_reader :element attr_reader :rescue_classes def initialize(element) @element = element @rescue_classes = [] set_rescue_classes end private def set_rescue_classes return if element[1].sexp_type != :array @rescue_classes = e...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/lib/fasterer/version.rb
lib/fasterer/version.rb
module Fasterer VERSION = '0.11.0' end
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/lib/fasterer/offense_collector.rb
lib/fasterer/offense_collector.rb
require 'forwardable' module Fasterer class OffenseCollector extend Forwardable def initialize @offenses = [] end def [](offense_name) @offenses.select { |offense| offense.name == offense_name } end def_delegators :@offenses, :push, :any?, :each, :group_by, :count end end
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/lib/fasterer/offense.rb
lib/fasterer/offense.rb
module Fasterer class Offense attr_reader :offense_name, :line_number alias_method :name, :offense_name alias_method :line, :line_number def initialize(offense_name, line_number) @offense_name = offense_name @line_number = line_number explanation # Set explanation right away. ...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/lib/fasterer/parser.rb
lib/fasterer/parser.rb
require 'ruby_parser' module Fasterer class Parser PARSER_CLASS = RubyParser def self.parse(ruby_code) PARSER_CLASS.for_current_ruby.parse(ruby_code) end end end
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/lib/fasterer/method_call.rb
lib/fasterer/method_call.rb
module Fasterer class MethodCall attr_reader :element attr_reader :receiver attr_reader :method_name attr_reader :arguments attr_reader :block_body attr_reader :block_argument_names alias_method :name, :method_name def initialize(element) @element = element set_call_eleme...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/lib/fasterer/method_definition.rb
lib/fasterer/method_definition.rb
module Fasterer class MethodDefinition attr_reader :element # for testing purposes attr_reader :method_name attr_reader :block_argument_name attr_reader :body attr_reader :arguments alias_method :name, :method_name def initialize(element) @element = element # Ripper element s...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/lib/fasterer/file_traverser.rb
lib/fasterer/file_traverser.rb
require 'pathname' require 'English' require_relative 'analyzer' require_relative 'config' require_relative 'painter' module Fasterer class FileTraverser CONFIG_FILE_NAME = Config::FILE_NAME SPEEDUPS_KEY = Config::SPEEDUPS_KEY EXCLUDE_PATHS_KEY = Config::EXCLUDE_PATHS_KEY attr_reader :config ...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/lib/fasterer/analyzer.rb
lib/fasterer/analyzer.rb
require 'fasterer/method_definition' require 'fasterer/method_call' require 'fasterer/rescue_call' require 'fasterer/offense_collector' require 'fasterer/parser' require 'fasterer/scanners/method_call_scanner' require 'fasterer/scanners/rescue_call_scanner' require 'fasterer/scanners/method_definition_scanner' module ...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/lib/fasterer/cli.rb
lib/fasterer/cli.rb
require_relative 'file_traverser' module Fasterer class CLI def self.execute file_traverser = Fasterer::FileTraverser.new(ARGV[0]) file_traverser.traverse abort if file_traverser.offenses_found? end end end
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/lib/fasterer/config.rb
lib/fasterer/config.rb
require 'yaml' require 'pathname' module Fasterer class Config FILE_NAME = '.fasterer.yml' SPEEDUPS_KEY = 'speedups' EXCLUDE_PATHS_KEY = 'exclude_paths' def ignored_speedups @ignored_speedups ||= file[SPEEDUPS_KEY].select { |_, value| value == false }.keys.map(&:to_sym) ...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/lib/fasterer/token.rb
lib/fasterer/token.rb
module Fasterer class Token def initialize(name) @name = name end def method_definition? name == :def end def method_call? name == :call end def command_call? name == :command end def parallel_assignment? name == :massign end def for_loop?...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/lib/fasterer/painter.rb
lib/fasterer/painter.rb
module Fasterer module Painter COLOR_CODES = { red: 31, green: 32, } def self.paint(string, color) color_code = COLOR_CODES[color.to_sym] if color_code.nil? raise ArgumentError, "Color #{color} is not supported. Allowed colors are #{COLOR_CODES.keys.join(', ')}" end ...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/lib/fasterer/scanners/offensive.rb
lib/fasterer/scanners/offensive.rb
require 'fasterer/offense' module Fasterer module Offensive attr_accessor :offense def offensive? !!offense end alias_method :offense_detected?, :offensive? private def add_offense(offense_name, element_line_number = element.line) self.offense = Fasterer::Offense.new(offense_n...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/lib/fasterer/scanners/method_definition_scanner.rb
lib/fasterer/scanners/method_definition_scanner.rb
require 'fasterer/method_definition' require 'fasterer/method_call' require 'fasterer/offense' require 'fasterer/scanners/offensive' module Fasterer class MethodDefinitionScanner include Fasterer::Offensive attr_reader :element def initialize(element) @element = element check_offense en...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/lib/fasterer/scanners/rescue_call_scanner.rb
lib/fasterer/scanners/rescue_call_scanner.rb
require 'fasterer/rescue_call' require 'fasterer/offense' require 'fasterer/scanners/offensive' module Fasterer class RescueCallScanner include Fasterer::Offensive attr_reader :element def initialize(element) @element = element check_offense end private def check_offense ...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
DamirSvrtan/fasterer
https://github.com/DamirSvrtan/fasterer/blob/5c113a97e27797b2bf2f2b1326a3a20280bf6588/lib/fasterer/scanners/method_call_scanner.rb
lib/fasterer/scanners/method_call_scanner.rb
require 'fasterer/method_call' require 'fasterer/offense' require 'fasterer/scanners/offensive' module Fasterer class MethodCallScanner include Fasterer::Offensive attr_reader :element def initialize(element) @element = element check_offense end def method_call @method_call |...
ruby
MIT
5c113a97e27797b2bf2f2b1326a3a20280bf6588
2026-01-04T16:00:49.658529Z
false
sinclairtarget/um
https://github.com/sinclairtarget/um/blob/b56b72949e550eba01882fbf73f95756ed852de3/libexec/um-config.rb
libexec/um-config.rb
require_relative '../lib/um.rb' Options.parse! do |available_opts| available_opts.banner = 'usage: um config [config key]' available_opts.on('-h', '--help', 'Print this help message.') do puts available_opts exit 0 end end config = UmConfig.source # If a valid key has been specified, print the value c...
ruby
MIT
b56b72949e550eba01882fbf73f95756ed852de3
2026-01-04T16:00:40.275266Z
false
sinclairtarget/um
https://github.com/sinclairtarget/um/blob/b56b72949e550eba01882fbf73f95756ed852de3/libexec/um-read.rb
libexec/um-read.rb
require 'tempfile' require 'kramdown' require_relative '../lib/um.rb' options = Options.parse! do |available_opts, set_opts| available_opts.banner = 'usage: um read [OPTIONS...] <page name>' available_opts.on( '-t', '--topic TOPIC', 'Set topic for a single invocation.' ) do |topic| set_opts[:topic] = to...
ruby
MIT
b56b72949e550eba01882fbf73f95756ed852de3
2026-01-04T16:00:40.275266Z
false
sinclairtarget/um
https://github.com/sinclairtarget/um/blob/b56b72949e550eba01882fbf73f95756ed852de3/libexec/um-edit.rb
libexec/um-edit.rb
require 'fileutils' require 'tempfile' require_relative '../lib/um.rb' options = Options.parse! do |available_opts, set_opts| available_opts.banner = 'usage: um edit [OPTIONS...] <page name>' available_opts.on( '-t', '--topic TOPIC', 'Set topic for a single invocation.' ) do |topic| set_opts[:topic] = t...
ruby
MIT
b56b72949e550eba01882fbf73f95756ed852de3
2026-01-04T16:00:40.275266Z
false
sinclairtarget/um
https://github.com/sinclairtarget/um/blob/b56b72949e550eba01882fbf73f95756ed852de3/libexec/um-help.rb
libexec/um-help.rb
require_relative '../lib/um.rb' def run_help_only(file_name) exec(%{ruby "#{file_name}" --help}) end options = Options.parse! do |opts| opts.banner = 'usage: um help <sub-command>' opts.on('-h', '--help', 'Print this help message.') do puts opts exit 0 end end sub_command = ARGV.first if sub_command...
ruby
MIT
b56b72949e550eba01882fbf73f95756ed852de3
2026-01-04T16:00:40.275266Z
false
sinclairtarget/um
https://github.com/sinclairtarget/um/blob/b56b72949e550eba01882fbf73f95756ed852de3/libexec/um-topic.rb
libexec/um-topic.rb
require_relative '../lib/um.rb' Options.parse! do |available_opts| available_opts.banner = 'usage: um topic [OPTIONS...] [topic]' available_opts.on('-d', '--default', 'Resets the topic to the default.') do Topic.clear exit 0 end available_opts.on('-h', '--help', 'Print this help message.') do put...
ruby
MIT
b56b72949e550eba01882fbf73f95756ed852de3
2026-01-04T16:00:40.275266Z
false
sinclairtarget/um
https://github.com/sinclairtarget/um/blob/b56b72949e550eba01882fbf73f95756ed852de3/libexec/um-list.rb
libexec/um-list.rb
require_relative '../lib/um.rb' options = Options.parse! do |available_opts, set_opts| available_opts.banner = 'usage: um list [OPTIONS...]' available_opts.on( '-t', '--topic TOPIC', 'Set topic for a single invocation.' ) do |topic| set_opts[:topic] = topic end available_opts.on('-h', '--help', 'Pr...
ruby
MIT
b56b72949e550eba01882fbf73f95756ed852de3
2026-01-04T16:00:40.275266Z
false
sinclairtarget/um
https://github.com/sinclairtarget/um/blob/b56b72949e550eba01882fbf73f95756ed852de3/libexec/um-topics.rb
libexec/um-topics.rb
require_relative '../lib/um.rb' Options.parse! do |available_opts| available_opts.banner = 'usage: um topics [OPTIONS...]' available_opts.on('-h', '--help', 'Print this help message.') do puts available_opts exit 0 end end config = UmConfig.source files = Dir["#{config.pages_directory}/*"].map { |file...
ruby
MIT
b56b72949e550eba01882fbf73f95756ed852de3
2026-01-04T16:00:40.275266Z
false
sinclairtarget/um
https://github.com/sinclairtarget/um/blob/b56b72949e550eba01882fbf73f95756ed852de3/libexec/um-rm.rb
libexec/um-rm.rb
require 'shellwords' require_relative '../lib/um.rb' options = Options.parse! do |available_opts, set_opts| available_opts.banner = 'usage: um rm [OPTIONS...] <page name>' available_opts.on( '-t', '--topic TOPIC', 'Set topic for a single invocation.' ) do |topic| set_opts[:topic] = topic end availa...
ruby
MIT
b56b72949e550eba01882fbf73f95756ed852de3
2026-01-04T16:00:40.275266Z
false
sinclairtarget/um
https://github.com/sinclairtarget/um/blob/b56b72949e550eba01882fbf73f95756ed852de3/lib/um.rb
lib/um.rb
require_relative 'um/umconfig.rb' require_relative 'um/topic.rb' require_relative 'um/preprocessor.rb' require_relative 'um/commands.rb' require_relative 'um/options.rb'
ruby
MIT
b56b72949e550eba01882fbf73f95756ed852de3
2026-01-04T16:00:40.275266Z
false
sinclairtarget/um
https://github.com/sinclairtarget/um/blob/b56b72949e550eba01882fbf73f95756ed852de3/lib/um/topic.rb
lib/um/topic.rb
require 'etc' require 'fileutils' module Topic def self.current(config) file_path = topic_file_path if File.exist? file_path read_topic(file_path) else default = config[:default_topic] write_topic(topic_file_path, default) default end end def self.set(topic) write_top...
ruby
MIT
b56b72949e550eba01882fbf73f95756ed852de3
2026-01-04T16:00:40.275266Z
false
sinclairtarget/um
https://github.com/sinclairtarget/um/blob/b56b72949e550eba01882fbf73f95756ed852de3/lib/um/options.rb
lib/um/options.rb
require 'optparse' # Thin wrapper for optparse class Options def initialize(parser, set_options) @parser = parser @set_options = set_options end def available @parser end def [](key) @set_options[key] end def self.parse! set_options = {} opts_parser = OptionParser.new do |opts...
ruby
MIT
b56b72949e550eba01882fbf73f95756ed852de3
2026-01-04T16:00:40.275266Z
false
sinclairtarget/um
https://github.com/sinclairtarget/um/blob/b56b72949e550eba01882fbf73f95756ed852de3/lib/um/umconfig.rb
lib/um/umconfig.rb
require 'etc' require 'fileutils' require 'forwardable' class UmConfig extend Forwardable DEFAULT_CONFIG_DIR_REL_PATH = '~/.um'.freeze DEFAULT_TEMPLATE_REL_PATH = '../../templates/template'.freeze UM_MARKDOWN_EXT = '.md'.freeze DEFAULT_CONFIG = { editor: ENV['EDITOR'] || 'vi', pager: ENV['PAGER'] ...
ruby
MIT
b56b72949e550eba01882fbf73f95756ed852de3
2026-01-04T16:00:40.275266Z
false
sinclairtarget/um
https://github.com/sinclairtarget/um/blob/b56b72949e550eba01882fbf73f95756ed852de3/lib/um/preprocessor.rb
lib/um/preprocessor.rb
require 'time' require 'date' # template preprocessor module Preprocessor def self.preprocess(template, page_name, topic) template.gsub(/\$\w+/) do |match| case match when '$name' page_name when '$NAME' page_name.upcase when '$topic' topic when '$time' ...
ruby
MIT
b56b72949e550eba01882fbf73f95756ed852de3
2026-01-04T16:00:40.275266Z
false
sinclairtarget/um
https://github.com/sinclairtarget/um/blob/b56b72949e550eba01882fbf73f95756ed852de3/lib/um/commands.rb
lib/um/commands.rb
module Commands LIBEXEC_FILENAME_FORMAT = 'um-%s.rb'.freeze ALIASES = { 'l' => 'list', 'r' => 'read', 'e' => 'edit', 's' => 'edit', # legacy support 'set' => 'edit', # legacy support 't' => 'topic', 'c' => 'config', 'h' => 'help' }.freeze # Executes the right Ruby file fo...
ruby
MIT
b56b72949e550eba01882fbf73f95756ed852de3
2026-01-04T16:00:40.275266Z
false
brunofacca/zen-rails-security-checklist
https://github.com/brunofacca/zen-rails-security-checklist/blob/3e5d717946c162b5e8a0256a55a6f378ac289f8a/empty_file.rb
empty_file.rb
puts "Please ignore this file. Its only purpose is to make GitHub recognize this repo as a Ruby project."
ruby
MIT
3e5d717946c162b5e8a0256a55a6f378ac289f8a
2026-01-04T16:00:51.656354Z
false
github/india
https://github.com/github/india/blob/cde7f5010d90226a6c10049755daffced3d8000b/script/website-pr-validation.rb
script/website-pr-validation.rb
require "rubygems" require "octokit" require "json" require "logger" require "safe_yaml" CLIENT = Octokit::Client.new(:access_token => ENV["GITHUB_TOKEN"]) REPOSITORY= ENV["INDIA_REPO_NWO"] BASE_PATH = "website/data/open-source" @logger = Logger.new(STDOUT) # Flag for checking if the issues are present $ISSUES_PRESEN...
ruby
CC0-1.0
cde7f5010d90226a6c10049755daffced3d8000b
2026-01-04T16:00:55.628607Z
false
hashrocket/decent_exposure
https://github.com/hashrocket/decent_exposure/blob/1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8/spec/spec_helper.rb
spec/spec_helper.rb
require "decent_exposure"
ruby
MIT
1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8
2026-01-04T16:00:55.326790Z
false
hashrocket/decent_exposure
https://github.com/hashrocket/decent_exposure/blob/1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8/spec/support/rails_app.rb
spec/support/rails_app.rb
require "action_controller" require "rails" def request_params(params) return params if Rails::VERSION::MAJOR < 5 {params: params} end module Rails class App def env_config {} end def routes @routes ||= ActionDispatch::Routing::RouteSet.new.tap do |routes| routes.draw do ...
ruby
MIT
1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8
2026-01-04T16:00:55.326790Z
false
hashrocket/decent_exposure
https://github.com/hashrocket/decent_exposure/blob/1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8/spec/generators/decent_exposure/scaffold_templates_generator_spec.rb
spec/generators/decent_exposure/scaffold_templates_generator_spec.rb
require "spec_helper" RSpec.describe DecentExposure::Generators::ScaffoldTemplatesGenerator, type: :generator do subject(:generator) { described_class.new } context "with erb" do it "generates controller and erb views" do allow(generator).to receive(:copy_file).with("controller.rb", "lib/templates/rails...
ruby
MIT
1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8
2026-01-04T16:00:55.326790Z
false
hashrocket/decent_exposure
https://github.com/hashrocket/decent_exposure/blob/1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8/spec/features/birds_mailer_spec.rb
spec/features/birds_mailer_spec.rb
require "spec_helper" require "support/rails_app" require "rspec/rails" require "action_mailer" class BirdsMailer < ActionMailer::Base end class BirdsMailer expose(:birds, -> { Bird.all }) expose(:bird) def hello_birds mail { |format| format.text { render plain: "Hello #{birds}" } } end def hello_bird...
ruby
MIT
1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8
2026-01-04T16:00:55.326790Z
false
hashrocket/decent_exposure
https://github.com/hashrocket/decent_exposure/blob/1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8/spec/features/birds_controller_spec.rb
spec/features/birds_controller_spec.rb
require "spec_helper" require "support/rails_app" require "rspec/rails" RSpec.describe BirdsController, type: :controller do let(:bird) { Bird.new } context "when birds relation is exposed" do class BirdsController expose :birds, -> { Bird.all } end it "fetches all birds" do expect(Bird)....
ruby
MIT
1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8
2026-01-04T16:00:55.326790Z
false
hashrocket/decent_exposure
https://github.com/hashrocket/decent_exposure/blob/1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8/spec/features/api_birds_controller_spec.rb
spec/features/api_birds_controller_spec.rb
require "spec_helper" require "support/rails_app" require "rspec/rails" RSpec.describe Api::BirdsController, type: :controller do let(:bird) { Bird.new } context "when birds relation is exposed" do class Api::BirdsController expose :birds, -> { Bird.all } end it "fetches all birds" do exp...
ruby
MIT
1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8
2026-01-04T16:00:55.326790Z
false
hashrocket/decent_exposure
https://github.com/hashrocket/decent_exposure/blob/1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8/spec/decent_exposure/controller_spec.rb
spec/decent_exposure/controller_spec.rb
require "spec_helper" RSpec.describe DecentExposure::Controller do class Thing; end class DifferentThing; end class BaseController def self.helper_method(*) end def params @params ||= HashWithIndifferentAccess.new end end let(:controller_klass) do Class.new(BaseController) do ...
ruby
MIT
1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8
2026-01-04T16:00:55.326790Z
false
hashrocket/decent_exposure
https://github.com/hashrocket/decent_exposure/blob/1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8/lib/decent_exposure.rb
lib/decent_exposure.rb
require "decent_exposure/version" require "active_support/all" require "generators/decent_exposure/scaffold_templates_generator" module DecentExposure autoload :Controller, "decent_exposure/controller" autoload :Mailer, "decent_exposure/mailer" autoload :Exposure, "decent_exposure/exposure" autoload :Attribute...
ruby
MIT
1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8
2026-01-04T16:00:55.326790Z
false
hashrocket/decent_exposure
https://github.com/hashrocket/decent_exposure/blob/1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8/lib/generators/decent_exposure/scaffold_templates_generator.rb
lib/generators/decent_exposure/scaffold_templates_generator.rb
require "rails/generators" module DecentExposure module Generators class ScaffoldTemplatesGenerator < Rails::Generators::Base desc "Generate DecentExposure scaffold template files" source_root File.expand_path("../templates", __FILE__) class_option :template_engine, desc: "Template engine to be...
ruby
MIT
1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8
2026-01-04T16:00:55.326790Z
false
hashrocket/decent_exposure
https://github.com/hashrocket/decent_exposure/blob/1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8/lib/generators/decent_exposure/templates/controller.rb
lib/generators/decent_exposure/templates/controller.rb
<% if namespaced? -%> require_dependency "<%= namespaced_path %>/application_controller" <% end -%> <% module_namespacing do -%> class <%= controller_class_name %>Controller < ApplicationController expose :<%= plural_table_name %>, ->{ <%= orm_class.all(class_name) %> } expose :<%= singular_table_name %> def cr...
ruby
MIT
1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8
2026-01-04T16:00:55.326790Z
false
hashrocket/decent_exposure
https://github.com/hashrocket/decent_exposure/blob/1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8/lib/decent_exposure/mailer.rb
lib/decent_exposure/mailer.rb
module DecentExposure module Mailer def self.included(base) base.class_eval do attr_accessor :params def process_action(*args) arg = args.second self.params = arg.stringify_keys if arg && Hash === arg super end end end end end
ruby
MIT
1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8
2026-01-04T16:00:55.326790Z
false
hashrocket/decent_exposure
https://github.com/hashrocket/decent_exposure/blob/1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8/lib/decent_exposure/version.rb
lib/decent_exposure/version.rb
module DecentExposure VERSION = "3.0.4" end
ruby
MIT
1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8
2026-01-04T16:00:55.326790Z
false
hashrocket/decent_exposure
https://github.com/hashrocket/decent_exposure/blob/1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8/lib/decent_exposure/attribute.rb
lib/decent_exposure/attribute.rb
module DecentExposure class Attribute attr_reader :name, :fetch, :ivar_name # Public: Initialize an Attribute # # options - Hash of options for the Attribute # :name - The String name of the Attribute instance # :fetch - The Proc fetch to calculate # ...
ruby
MIT
1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8
2026-01-04T16:00:55.326790Z
false
hashrocket/decent_exposure
https://github.com/hashrocket/decent_exposure/blob/1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8/lib/decent_exposure/flow.rb
lib/decent_exposure/flow.rb
module DecentExposure class Flow attr_reader :controller, :options, :name # Public: Initialize a Flow. This object responds to missing # methods errors and attempts to delegate them to other objects. # # controller - The Controller class where the method was called. # options - The options...
ruby
MIT
1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8
2026-01-04T16:00:55.326790Z
false
hashrocket/decent_exposure
https://github.com/hashrocket/decent_exposure/blob/1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8/lib/decent_exposure/exposure.rb
lib/decent_exposure/exposure.rb
module DecentExposure class Exposure attr_reader :controller, :options # Public: Initializes an Exposure and makes it accessible to a controller. # For each Exposure, a getter and setter is defined. # Those getters and setters are made available to # the controller as helper methods. # # ...
ruby
MIT
1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8
2026-01-04T16:00:55.326790Z
false
hashrocket/decent_exposure
https://github.com/hashrocket/decent_exposure/blob/1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8/lib/decent_exposure/controller.rb
lib/decent_exposure/controller.rb
module DecentExposure module Controller extend ActiveSupport::Concern included do class_attribute :exposure_configuration, instance_accessor: false, instance_predicate: false end module ClassMethods # Public: Exposes an attribute to a controller Class. # # *args - An ...
ruby
MIT
1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8
2026-01-04T16:00:55.326790Z
false
hashrocket/decent_exposure
https://github.com/hashrocket/decent_exposure/blob/1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8/lib/decent_exposure/context.rb
lib/decent_exposure/context.rb
module DecentExposure class Context attr_reader :context, :attribute # Public: Initialize a context. # # context - The Class where the attribute is defined. # attribute - The attribute that will be accessed by a getter # and setter. def initialize(context, attribute) @...
ruby
MIT
1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8
2026-01-04T16:00:55.326790Z
false
hashrocket/decent_exposure
https://github.com/hashrocket/decent_exposure/blob/1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8/lib/decent_exposure/behavior.rb
lib/decent_exposure/behavior.rb
module DecentExposure module Behavior # Public: Fetches a scope. # # Finds an object. If it isn't found, the object gets instantiated. # # Returns the decorated object. def fetch instance = id ? find(id, computed_scope) : build(build_params, computed_scope) decorate(instance) e...
ruby
MIT
1d64ef2238d3eb6cf73c3887eb4398e94a2a1fd8
2026-01-04T16:00:55.326790Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/test/alias_controller_test.rb
test/alias_controller_test.rb
require File.dirname(__FILE__) + '/test_helper' class Twurl::AliasesController::DispatchTest < Minitest::Test attr_reader :options, :client def setup @options = Twurl::Options.test_exemplar @client = Twurl::OAuthClient.test_exemplar # Clean slate if Twurl::OAuthClient.rcfile.aliases Twurl::...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/test/authorization_controller_test.rb
test/authorization_controller_test.rb
require File.dirname(__FILE__) + '/test_helper' class Twurl::AuthorizationController::DispatchTest < Minitest::Test attr_reader :options, :client, :controller def setup @options = Twurl::Options.new @client = Twurl::OAuthClient.load_new_client_from_options(options) @controller = Twurl::Authoriza...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/test/rcfile_test.rb
test/rcfile_test.rb
require File.dirname(__FILE__) + '/test_helper' class Twurl::RCFile::PathConstructionTest < Minitest::Test def test_file_path_appends_file_to_directory assert_equal File.join(Twurl::RCFile.directory, Twurl::RCFile::FILE), Twurl::RCFile.file_path end end class Twurl::RCFile::LoadingTest < Minitest::Test def ...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/test/app_only_oauth_client_test.rb
test/app_only_oauth_client_test.rb
require File.dirname(__FILE__) + '/test_helper' class Twurl::AppOnlyOAuthClient::AbstractClientTest < Minitest::Test attr_reader :client, :options def setup Twurl::OAuthClient.instance_variable_set(:@rcfile, nil) @options = Twurl::Options.test_app_only_exemplar @client =...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/test/account_information_controller_test.rb
test/account_information_controller_test.rb
require File.dirname(__FILE__) + '/test_helper' class Twurl::AccountInformationController::DispatchWithNoAuthorizedAccountsTest < Minitest::Test attr_reader :options, :client, :controller def setup @options = Twurl::Options.new @client = Twurl::OAuthClient.load_new_client_from_options(options) @...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/test/test_helper.rb
test/test_helper.rb
require 'simplecov' SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter] SimpleCov.start require 'twurl' require 'minitest/autorun' require 'rr' Twurl::RCFile.directory = ENV['TMPDIR'] || File.dirname(__FILE__) module Twurl class Options class << self def test_exemplar options ...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/test/configuration_controller_test.rb
test/configuration_controller_test.rb
require File.dirname(__FILE__) + '/test_helper' class Twurl::ConfigurationController::DispatchTest < Minitest::Test def test_error_message_is_displayed_if_setting_is_unrecognized options = Twurl::Options.test_exemplar client = Twurl::OAuthClient.test_exemplar options.subcommands = ['unrecognized', 'val...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/test/request_controller_test.rb
test/request_controller_test.rb
require File.dirname(__FILE__) + '/test_helper' class Twurl::RequestController::AbstractTestCase < Minitest::Test attr_reader :options, :client, :controller def setup Twurl::CLI.output = StringIO.new @options = Twurl::Options.test_exemplar @client = Twurl::OAuthClient.test_exemplar @controll...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/test/oauth_client_test.rb
test/oauth_client_test.rb
require File.dirname(__FILE__) + '/test_helper' class Twurl::OAuthClient::AbstractOAuthClientTest < Minitest::Test TEST_PATH = '/1.1/url/does/not/matter.json' attr_reader :client, :options def setup Twurl::OAuthClient.instance_variable_set(:@rcfile, nil) @options = Twurl::Options.test_ex...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/test/cli_test.rb
test/cli_test.rb
require File.dirname(__FILE__) + '/test_helper' class Twurl::CLI::OptionParsingTest < Minitest::Test TEST_PATH = '/1.1/url/does/not/matter.json' module CommandParsingTests def test_no_command_specified_falls_to_default_command options = Twurl::CLI.parse_options([TEST_PATH]) assert_equal Twurl::CLI...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/test/cli_options_test.rb
test/cli_options_test.rb
require File.dirname(__FILE__) + '/test_helper' class Twurl::Options::Test < Minitest::Test attr_reader :options def setup @options = Twurl::Options.new end def test_base_url_is_built_from_protocol_and_host options = Twurl::CLI.parse_options(['-H', 'ads-api.twitter.com']) assert_equal 'https://ad...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/lib/twurl.rb
lib/twurl.rb
require 'rubygems' require 'oauth' require 'optparse' require 'ostruct' require 'stringio' require 'yaml' require 'json' library_files = Dir[File.join(File.dirname(__FILE__), "/twurl/**/*.rb")].sort library_files.each do |file| require file end module Twurl @options ||= Options.new class << self attr_access...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/lib/twurl/version.rb
lib/twurl/version.rb
module Twurl class Version MAJOR = 0 unless defined? Twurl::Version::MAJOR MINOR = 9 unless defined? Twurl::Version::MINOR PATCH = 7 unless defined? Twurl::Version::PATCH PRE = nil unless defined? Twurl::Version::PRE # Time.now.to_i.to_s class << self # @return [String] def to_s ...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/lib/twurl/authorization_controller.rb
lib/twurl/authorization_controller.rb
module Twurl class AuthorizationController < AbstractCommandController AUTHORIZATION_FAILED_MESSAGE = "Authorization failed. Check that your consumer key and secret are correct, as well as username and password." AUTHORIZATION_SUCCEEDED_MESSAGE = "Authorization successful" def dispatch client.exc...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/lib/twurl/account_information_controller.rb
lib/twurl/account_information_controller.rb
module Twurl class AccountInformationController < AbstractCommandController NO_AUTHORIZED_ACCOUNTS_MESSAGE = "No authorized accounts" def dispatch rcfile = OAuthClient.rcfile if rcfile.empty? CLI.puts NO_AUTHORIZED_ACCOUNTS_MESSAGE else profiles = rcfile.profiles pro...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/lib/twurl/oauth_client.rb
lib/twurl/oauth_client.rb
module Twurl class OAuthClient class << self def rcfile(reload = false) if reload || @rcfile.nil? @rcfile = RCFile.new end @rcfile end def load_from_options(options) if options.command == 'request' && has_oauth_options?(options) load_new_clien...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/lib/twurl/request_controller.rb
lib/twurl/request_controller.rb
module Twurl class RequestController < AbstractCommandController NO_URI_MESSAGE = 'No URI specified' INVALID_URI_MESSAGE = 'Invalid URI detected' READ_TIMEOUT_MESSAGE = 'A timeout occurred (Net::ReadTimeout). ' \ 'Please try again or increase the value using --timeout opt...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/lib/twurl/rcfile.rb
lib/twurl/rcfile.rb
module Twurl class RCFile FILE = '.twurlrc' class << self def directory @@directory ||= File.expand_path('~') end def directory=(dir) @@directory = dir end def file_path File.join(directory, FILE) end def load YAML.load_file(file_pat...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/lib/twurl/aliases_controller.rb
lib/twurl/aliases_controller.rb
module Twurl class AliasesController < AbstractCommandController NO_ALIASES_MESSAGE = "No aliases exist. Set one this way: twurl alias h /1.1/statuses/home_timeline.json" NO_PATH_PROVIDED_MESSAGE = "No path was provided to alias. Paths must start with a forward slash (ex. /1.1/statuses/update.json)." ...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/lib/twurl/app_only_token_information_controller.rb
lib/twurl/app_only_token_information_controller.rb
module Twurl class AppOnlyTokenInformationController < AbstractCommandController NO_ISSUED_TOKENS_MESSAGE = "No issued application-only (Bearer) tokens" def dispatch rcfile = OAuthClient.rcfile if rcfile.empty? || rcfile.bearer_tokens.nil? CLI.puts NO_ISSUED_TOKENS_MESSAGE else ...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/lib/twurl/cli.rb
lib/twurl/cli.rb
module Twurl class CLI SUPPORTED_COMMANDS = %w(authorize accounts bearer_tokens alias set) DEFAULT_COMMAND = 'request' PATH_PATTERN = /^\/\w+/ PROTOCOL_PATTERN = /^\w+:\/\// README = File.dirname(__FILE__) + '/../../README.md' @output ||=...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/lib/twurl/configuration_controller.rb
lib/twurl/configuration_controller.rb
module Twurl class ConfigurationController < AbstractCommandController UNRECOGNIZED_SETTING_MESSAGE = "Unknown configuration setting: '%s'" def dispatch case options.subcommands.first when 'default' if profile = case options.subcommands.size when 2 ...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/lib/twurl/app_only_oauth_client.rb
lib/twurl/app_only_oauth_client.rb
require 'base64' require_relative 'oauth_client' module Twurl class AppOnlyOAuthClient < Twurl::OAuthClient AUTHORIZATION_FAILED_MESSAGE = "Authorization failed. Check that your consumer key and secret are correct." attr_reader :consumer_key, :consumer_secret, :bearer_token def initialize(options = {}...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false
twitter/twurl
https://github.com/twitter/twurl/blob/c256756dc89e8507cd77495d3ff9e0b6e49ae339/lib/twurl/abstract_command_controller.rb
lib/twurl/abstract_command_controller.rb
module Twurl # Subclasses need to implement a `dispatch' instance method. class AbstractCommandController attr_reader :client, :options class << self def dispatch(*args, &block) new(*args, &block).dispatch end end def initialize(client, options) @client = client @op...
ruby
MIT
c256756dc89e8507cd77495d3ff9e0b6e49ae339
2026-01-04T16:00:57.775768Z
false