Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Address some Code Climate suggestions
- Loading branch information
Showing
23 changed files
with
124 additions
and
259 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
5 changes: 5 additions & 0 deletions
5
lib/numbers_and_words/strategies/figures_converter/options/base.rb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'numbers_and_words/strategies/figures_converter/options/base/gender' | ||
require 'numbers_and_words/strategies/figures_converter/options/base/ordinal' | ||
require 'numbers_and_words/strategies/figures_converter/options/base/remove_zero' |
30 changes: 30 additions & 0 deletions
30
lib/numbers_and_words/strategies/figures_converter/options/base/gender.rb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
module NumbersAndWords | ||
module Strategies | ||
module FiguresConverter | ||
module Options | ||
module Base | ||
class Gender | ||
attr_accessor :strategy, :options | ||
|
||
def initialize(proxy, *_args) | ||
@strategy = proxy.strategy | ||
@options = proxy.options | ||
end | ||
|
||
def result | ||
active? ? @options[:gender].to_sym : :male | ||
end | ||
|
||
private | ||
|
||
def active? | ||
@options[:gender] | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
28 changes: 28 additions & 0 deletions
28
lib/numbers_and_words/strategies/figures_converter/options/base/ordinal.rb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
module NumbersAndWords | ||
module Strategies | ||
module FiguresConverter | ||
module Options | ||
module Base | ||
class Ordinal | ||
def initialize(proxy, *_args) | ||
@strategy = proxy.strategy | ||
@options = proxy.options | ||
end | ||
|
||
def result | ||
return :ordinal if active? | ||
end | ||
|
||
private | ||
|
||
def active? | ||
@options[:ordinal] | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
30 changes: 30 additions & 0 deletions
30
lib/numbers_and_words/strategies/figures_converter/options/base/remove_zero.rb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
module NumbersAndWords | ||
module Strategies | ||
module FiguresConverter | ||
module Options | ||
module Base | ||
class RemoveZero | ||
attr_accessor :strategy, :options | ||
|
||
def initialize(proxy, *_args) | ||
@strategy = proxy.strategy | ||
@options = proxy.options | ||
end | ||
|
||
def result | ||
active? | ||
end | ||
|
||
private | ||
|
||
def active? | ||
@options[:remove_zero] | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.