Sha256: db91338d40853b4add3d684d98c094a5754445a56670212d6232107c39509f4b

Contents?: true

Size: 1.34 KB

Versions: 40

Compression:

Stored size: 1.34 KB

Contents

module Eco::API::UseCases::GraphQL::Samples::Location::Service
  module TreeDiff
    module Convertible
      module Inputable
        class << self
          def included(base)
            super(base)
            base.send :include, Eco::Data::Files
          end
        end

        include Eco::API::UseCases::GraphQL::Helpers::Base::CaseEnv

        IN_FILENAME  = /requested_tree\.csv/.freeze
        IN_FOLDER    = 'sftp'.freeze

        private

        def input_encoding
          options.dig(:input, :file, :encoding) || 'utf-8'
        end

        def input_file
          @input_file ||= (options.dig(:input, :file, :name) || newest_file).tap do |file|
            if file
              log(:info) { "Using input file '#{file}'" }
            else
              log(:warn) { "Could not find any input file" }
              exit(1)
            end
          end
        end

        def newest_file
          @newest_file ||= csv_files.last
        end

        #@note via Eco::Data::Files
        def csv_files
          self.class.csv_files(input_folder, regexp: input_file_pattern)
        end

        def input_file_pattern
          self.class::IN_FILENAME
        end

        def input_folder
          "#{config.active_enviro}/#{self.class::IN_FOLDER}"
        end
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
eco-helpers-3.0.1 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-3.0.0 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-2.7.25 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-2.7.24 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-2.7.23 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-2.7.22 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-2.7.21 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-2.7.20 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-2.7.19 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-2.7.18 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-2.7.17 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-2.7.16 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-2.7.15 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-2.7.14 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-2.7.13 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-2.7.12 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-2.7.4 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-2.7.2 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-2.7.1 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb
eco-helpers-2.7.0 lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb