Class: Npm::Rails::PackageFileParser

Inherits:
Object
  • Object
show all
Defined in:
lib/npm/rails/package_file_parser.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePackageFileParser

Returns a new instance of PackageFileParser.



13
14
15
16
# File 'lib/npm/rails/package_file_parser.rb', line 13

def initialize
  @packages = []
  @development = false
end

Instance Attribute Details

#packagesObject (readonly)

Returns the value of attribute packages.



5
6
7
# File 'lib/npm/rails/package_file_parser.rb', line 5

def packages
  @packages
end

Class Method Details

.parse(package_file_path) ⇒ Object



7
8
9
10
11
# File 'lib/npm/rails/package_file_parser.rb', line 7

def self.parse(package_file_path)
  parser = new
  parser.parse(package_file_path)
  parser.packages
end

Instance Method Details

#parse(package_file_path) ⇒ Object



18
19
20
21
# File 'lib/npm/rails/package_file_parser.rb', line 18

def parse(package_file_path)
 @package_file = File.open(package_file_path, "r", &:read)
 eval(@package_file)
end