Class: EacRubyGemSupport::SourceTargetFixtures

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_ruby_gem_support/source_target_fixtures.rb,
lib/eac_ruby_gem_support/source_target_fixtures/source_target_file.rb

Overview

Lists pairs of source/target files in a directory.

Defined Under Namespace

Classes: SourceTargetFile

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fixtures_directory) ⇒ Object

Parameters:

  • fixtures_directory (Pathname)


22
# File 'lib/eac_ruby_gem_support/source_target_fixtures.rb', line 22

common_constructor :fixtures_directory

Instance Attribute Details

#fixtures_directoryString (readonly)

Returns:

  • (String)


# File 'lib/eac_ruby_gem_support/source_target_fixtures.rb', line 17

Class Method Details

.source_target_basename(file) ⇒ Object



11
12
13
14
# File 'lib/eac_ruby_gem_support/source_target_fixtures.rb', line 11

def source_target_basename(file)
  m = /^(.+)\.(?:source|target)(?:\..+)?$/.match(File.basename(file))
  m ? m[1] : nil
end

Instance Method Details

#source_file(basename) ⇒ Object



50
51
52
# File 'lib/eac_ruby_gem_support/source_target_fixtures.rb', line 50

def source_file(basename)
  fixture_file(basename, 'source')
end

#source_filesObject



30
31
32
33
34
35
36
# File 'lib/eac_ruby_gem_support/source_target_fixtures.rb', line 30

def source_files
  r = []
  source_target_files.each do |st|
    r << st.source if st.source
  end
  r
end

#source_target_filesObject



24
25
26
27
28
# File 'lib/eac_ruby_gem_support/source_target_fixtures.rb', line 24

def source_target_files
  sources_targets_basenames.map do |basename|
    ::EacRubyGemSupport::SourceTargetFixtures::SourceTargetFile.new(self, basename)
  end
end

#target_file(basename) ⇒ Object



46
47
48
# File 'lib/eac_ruby_gem_support/source_target_fixtures.rb', line 46

def target_file(basename)
  fixture_file(basename, 'target')
end

#target_filesObject



38
39
40
41
42
43
44
# File 'lib/eac_ruby_gem_support/source_target_fixtures.rb', line 38

def target_files
  r = []
  source_target_files.each do |st|
    r << st.target if st.target
  end
  r
end