Class: EmbeddedJs::PackageConfig
- Inherits:
-
Object
- Object
- EmbeddedJs::PackageConfig
- Defined in:
- lib/embedded_js/package_config.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(package_path) ⇒ PackageConfig
constructor
A new instance of PackageConfig.
- #package_files_paths ⇒ Object
Constructor Details
#initialize(package_path) ⇒ PackageConfig
Returns a new instance of PackageConfig.
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
#path ⇒ Object (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_paths ⇒ Object
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 |