Sha256: 0b8aa5ef761c4f439c0e9e849da7d21c198417def41d8fc398d574942853b783
Contents?: true
Size: 1.32 KB
Versions: 68
Compression:
Stored size: 1.32 KB
Contents
# frozen_string_literal: true require 'avm/eac_generic_base0/file_formats/base' require 'avm/eac_ruby_base1/rubocop' module Avm module EacRubyBase1 module FileFormats class Base < ::Avm::EacGenericBase0::FileFormats::Base class FileResourceName enable_method_class common_constructor :file_format, :path do self.path = path.to_pathname end LIBRARY_PATTERNS = [%r{lib/((?!.*/lib/).+)\.rb\z}, %r{app/[^/]+/(.+)\.rb\z}].freeze SPEC_PATTERNS = [%r{spec/[^/]+/(.+)_spec\.rb\z}].freeze # @param path [Pathname] # @return [Avm::FileFormats::FileWith] def result result_from_spec || result_from_library || result_from_superclass end private def result_from_library result_from_patterns(LIBRARY_PATTERNS) { |m| m[1].camelize } end def result_from_patterns(patterns, &block) file_format.result_from_patterns(patterns, path, &block) end def result_from_spec result_from_patterns(SPEC_PATTERNS) { |m| "RSpec.describe('#{m[1].camelize}')" } end def result_from_superclass file_format.result_from_superclass(path) end end end end end end
Version data entries
68 entries across 68 versions & 2 rubygems