Class: EacTemplates::Sources::FromGem

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_templates/sources/from_gem.rb

Constant Summary collapse

TEMPLATES_DIR_SUBPATH =
'template'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.include_all(searcher = nil) ⇒ Object



9
10
11
# File 'lib/eac_templates/sources/from_gem.rb', line 9

def include_all(searcher = nil)
  ::Gem::Specification.each { |gemspec| new(gemspec, searcher).include }
end

Instance Method Details

#exist?Boolean

Returns:

  • (Boolean)


21
# File 'lib/eac_templates/sources/from_gem.rb', line 21

delegate :exist?, to: :path

#includePathname

Returns:

  • (Pathname)


24
25
26
27
28
29
# File 'lib/eac_templates/sources/from_gem.rb', line 24

def include
  return nil unless exist?

  searcher.included_paths << path
  path
end

#pathPathname

Returns:

  • (Pathname)


32
33
34
# File 'lib/eac_templates/sources/from_gem.rb', line 32

def path
  gemspec.gem_dir.to_pathname.join(TEMPLATES_DIR_SUBPATH)
end