Class: ConvenientService::Utils::Method::Name::Append
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Utils::Method::Name::Append
- Defined in:
- lib/convenient_service/utils/method/name/append.rb
Instance Attribute Summary collapse
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#method_suffix ⇒ Object
readonly
Returns the value of attribute method_suffix.
Instance Method Summary collapse
Methods inherited from Support::Command
Constructor Details
#initialize(method_name, method_suffix) ⇒ void
30 31 32 33 |
# File 'lib/convenient_service/utils/method/name/append.rb', line 30 def initialize(method_name, method_suffix) @method_name = method_name.to_s @method_suffix = method_suffix.to_s end |
Instance Attribute Details
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
17 18 19 |
# File 'lib/convenient_service/utils/method/name/append.rb', line 17 def method_name @method_name end |
#method_suffix ⇒ Object (readonly)
Returns the value of attribute method_suffix.
23 24 25 |
# File 'lib/convenient_service/utils/method/name/append.rb', line 23 def method_suffix @method_suffix end |
Instance Method Details
#call ⇒ String
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/convenient_service/utils/method/name/append.rb', line 38 def call return "" if method_name.empty? if method_name.end_with?("!") "#{method_name.delete_suffix("!")}#{method_suffix}!" elsif method_name.end_with?("?") "#{method_name.delete_suffix("?")}#{method_suffix}?" else "#{method_name}#{method_suffix}" end end |