Skip to content

Commit

Permalink
Replace inflecto with dry-inflector
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloh committed Mar 2, 2018
1 parent e8516d3 commit 027cf0e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
## [0.6.0] - 2018-03-01
### Changed
- Replace unmaintained `inflecto` gem with `dry-inflector`

## [0.5.1] - 2017-12-18
### Changed
- Change behavior for `:fetch_model` step option `search_by:` to override both the search column and the input key (combine it with `using:` if you need a different value for the input key as well)
- `:fetch_model` step will no longer hit the database if the input key is nil and just return a `:not_found` error instead

## [0.5.0] - 2017-11-6
## [0.5.0] - 2017-11-06
### Changed
- Change base class for `Pathway::Error` from `StandardError` to `Object`

Expand Down
9 changes: 5 additions & 4 deletions lib/pathway.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
require 'forwardable'
require 'inflecto'
require 'dry/inflector'
require 'contextualizer'
require 'pathway/version'
require 'pathway/result'

module Pathway
Inflector = Dry::Inflector.new
class Operation
def self.plugin(name, *args)
require "pathway/plugins/#{Inflecto.underscore(name)}" if name.is_a?(Symbol)
require "pathway/plugins/#{Inflector.underscore(name)}" if name.is_a?(Symbol)

plugin = name.is_a?(Module) ? name : Plugins.const_get(Inflecto.camelize(name))
plugin = name.is_a?(Module) ? name : Plugins.const_get(Inflector.camelize(name))

self.extend plugin::ClassMethods if plugin.const_defined? :ClassMethods
self.include plugin::InstanceMethods if plugin.const_defined? :InstanceMethods
Expand Down Expand Up @@ -42,7 +43,7 @@ def initialize(type:, message: nil, details: nil)
private

def default_message_for(type)
self.class.default_messages[type] || Inflecto.humanize(type)
self.class.default_messages[type] || Inflector.humanize(type)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/pathway/plugins/sequel_models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module ClassMethods
def model(model_class, search_by: model_class.primary_key, set_result_key: true)
self.model_class = model_class
self.search_field = search_by
self.result_key = Inflecto.underscore(model_class.name.split('::').last).to_sym if set_result_key
self.result_key = Inflector.underscore(Inflector.demodulize(model_class.name)).to_sym if set_result_key
end

def inherited(subclass)
Expand Down
2 changes: 1 addition & 1 deletion lib/pathway/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Pathway
VERSION = '0.5.1'
VERSION = '0.6.0'
end
2 changes: 1 addition & 1 deletion pathway.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = ">= 2.4.0"

spec.add_dependency "inflecto"
spec.add_dependency "dry-inflector", ">= 0.1.1"
spec.add_dependency "contextualizer", "~> 0.0.3"

spec.add_development_dependency "dry-validation", "~> 0.11"
Expand Down

0 comments on commit 027cf0e

Please sign in to comment.