Class: Cure::Extraction
- Inherits:
-
Object
- Object
- Cure::Extraction
- Defined in:
- lib/cure/template/extraction.rb
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Extraction
constructor
A new instance of Extraction.
-
#required_named_ranges(candidate_nrs) ⇒ Array
We only need to get the named ranges where the candidates have specified interest in them.
Constructor Details
#initialize ⇒ Extraction
Returns a new instance of Extraction.
11 12 13 14 15 16 17 18 |
# File 'lib/cure/template/extraction.rb', line 11 def initialize @named_ranges = [{ "name" => "default", "section" => -1 }] @variables = [] end |
Instance Attribute Details
#named_ranges ⇒ Object
6 7 8 |
# File 'lib/cure/template/extraction.rb', line 6 def named_ranges @named_ranges end |
#variables ⇒ Object
9 10 11 |
# File 'lib/cure/template/extraction.rb', line 9 def variables @variables end |
Class Method Details
.from_hash(hash) ⇒ Cure::Extraction
22 23 24 25 26 27 |
# File 'lib/cure/template/extraction.rb', line 22 def self.from_hash(hash) this = Cure::Extraction.new this.named_ranges.push(*hash["named_ranges"]) this.variables.push(*hash["variables"]) this end |
Instance Method Details
#required_named_ranges(candidate_nrs) ⇒ Array
We only need to get the named ranges where the candidates have specified interest in them.
34 35 36 |
# File 'lib/cure/template/extraction.rb', line 34 def required_named_ranges(candidate_nrs) @named_ranges.select { |nr| candidate_nrs.include?(nr["name"]) } end |