Class: Cure::Transformations

Inherits:
Object
  • Object
show all
Defined in:
lib/cure/template/transformations.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTransformations

Returns a new instance of Transformations.



12
13
14
15
# File 'lib/cure/template/transformations.rb', line 12

def initialize
  @candidates = []
  @placeholders = {}
end

Instance Attribute Details

#candidatesObject

Parameters:



6
7
8
# File 'lib/cure/template/transformations.rb', line 6

def candidates
  @candidates
end

#placeholdersObject

TODO: make class Placeholder

Parameters:

  • placeholders (Array<Hash>)


10
11
12
# File 'lib/cure/template/transformations.rb', line 10

def placeholders
  @placeholders
end

Class Method Details

.from_hash(hash) ⇒ Cure::Transformations

Parameters:

  • hash (Hash)

Returns:



19
20
21
22
23
24
# File 'lib/cure/template/transformations.rb', line 19

def self.from_hash(hash)
  this = Cure::Transformations.new
  this.candidates = hash["candidates"].map { |c| Cure::Transformation::Candidate.new.from_json(c) }
  this.placeholders = hash["placeholders"]
  this
end