Class: ConvenientService::Examples::Standard::Gemfile::Services::AssertFileNotEmpty
- Inherits:
-
Object
- Object
- ConvenientService::Examples::Standard::Gemfile::Services::AssertFileNotEmpty
- Includes:
- Service::Configs::Standard
- Defined in:
- lib/convenient_service/examples/standard/gemfile/services/assert_file_not_empty.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path:) ⇒ AssertFileNotEmpty
constructor
A new instance of AssertFileNotEmpty.
- #result ⇒ Object
Constructor Details
#initialize(path:) ⇒ AssertFileNotEmpty
Returns a new instance of AssertFileNotEmpty.
13 14 15 |
# File 'lib/convenient_service/examples/standard/gemfile/services/assert_file_not_empty.rb', line 13 def initialize(path:) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
11 12 13 |
# File 'lib/convenient_service/examples/standard/gemfile/services/assert_file_not_empty.rb', line 11 def path @path end |
Instance Method Details
#result ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/convenient_service/examples/standard/gemfile/services/assert_file_not_empty.rb', line 17 def result return error("Path is `nil`") if path.nil? return error("Path is empty") if path.empty? return failure("File with path `#{path}` is empty") if ::File.zero?(path) success end |