Class: EmbeddedJs::PackageConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/embedded_js/package_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(package_path) ⇒ PackageConfig

Returns a new instance of PackageConfig.

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
# File 'lib/embedded_js/package_config.rb', line 9

def initialize(package_path)
  @path = package_path

  raise ArgumentError, "#{package_path} does not have a package.json file." unless File.exist?(config_path)

  @config = JSON.parse(File.read(config_path))
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/embedded_js/package_config.rb', line 7

def path
  @path
end

Instance Method Details

#package_files_pathsObject



17
18
19
20
21
# File 'lib/embedded_js/package_config.rb', line 17

def package_files_paths
  specified_files.map { |f| "#{path}/#{f}" }.tap do |paths|
    paths << config_path unless paths.include?(config_path)
  end
end