Skip to content

Commit

Permalink
Merge pull request #12 from kfpo/feature/support-search-ruby-less-tha…
Browse files Browse the repository at this point in the history
…n-2-4

Support `search` for ruby less than 2.4.0
  • Loading branch information
akabiru authored Oct 4, 2018
2 parents 1362a0f + 33b619c commit 32b76ce
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
fakerbot (0.4.1)
fakerbot (0.4.2)
faker
pastel (~> 0.7.2)
thor (~> 0.20.0)
Expand Down
8 changes: 5 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
task default: :spec
1 change: 1 addition & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/setup'
require 'fakerbot'
Expand Down
2 changes: 1 addition & 1 deletion bin/fakerbot
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# frozen_string_literal: true

lib_path = File.expand_path('../lib', __dir__)
$:.unshift(lib_path) if !$:.include?(lib_path)
$LOAD_PATH.unshift(lib_path) unless $LOAD_PATH.include?(lib_path)
require 'fakerbot'

Signal.trap('INT') do
Expand Down
2 changes: 2 additions & 0 deletions lib/fakerbot.rb
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

require_relative 'fakerbot/cli'
2 changes: 1 addition & 1 deletion lib/fakerbot/reflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def all_descendants_with_methods
def search_descendants_matching_query
faker_descendants.each do |faker|
methods = faker.my_singleton_methods
matching = methods.select { |m| m.match?(/#{query}/i) }
matching = methods.select { |m| m.match(/#{query}/i) }
store(faker, matching)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/fakerbot/renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def verbose?

def verbose_output(method, const, arr)
fake, message = faker_method(method, const)
arr << crayon.dim.white("=> #{fake.to_s}") << crayon.dim.magenta.bold("#{message}")
arr << crayon.dim.white("=> #{fake}") << crayon.dim.magenta.bold(message.to_s)
end

def faker_method(method, const)
Expand All @@ -78,7 +78,7 @@ def faker_method(method, const)
end

def ensure_method_is_supported(method, const)
const.respond_to?(:"_deprecated_#{method.to_s}") ? ' ( WILL BE DEPRECATED )' : ''
const.respond_to?(:"_deprecated_#{method}") ? ' ( WILL BE DEPRECATED )' : ''
end
end
end
4 changes: 3 additions & 1 deletion lib/fakerbot/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module FakerBot
VERSION = '0.4.1'.freeze
VERSION = '0.4.2'
end
2 changes: 1 addition & 1 deletion spec/integration/list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
-v, [--verbose], [--no-verbose] # Include sample Faker output
List all Faker constants
OUT
OUT

expect(output).to match(expected_output)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
-v, [--verbose], [--no-verbose] # Include sample Faker output
Search Faker method(s)
OUT
OUT
expect(output).to match(expected_output)
end

Expand Down

0 comments on commit 32b76ce

Please sign in to comment.