Class: MyPrecious::PyPackageInfo::ReqSpecTransform

Inherits:
Parslet::Transform
  • Object
show all
Defined in:
lib/myprecious/python_packages.rb

Overview

Transforms parse tree from ReqSpecParser to usable objects

Instance Method Summary collapse

Instance Method Details

#apply_spec(ptree) ⇒ Object

Apply transform after normalizing a parse tree

This method should be applied only to a parse tree expected to come from a requirement specification.



459
460
461
462
463
464
465
466
# File 'lib/myprecious/python_packages.rb', line 459

def apply_spec(ptree)
  norm_ptree = {}
  # TODO: :extras should be in this list, and we should default them to []
  %i[package verreqs url].each do |c|
    norm_ptree[c] = ptree[c] if ptree.has_key?(c)
  end
  apply(norm_ptree)
end