Class: SktlToLiquid::Converter

Inherits:
Object
  • Object
show all
Defined in:
lib/sktl_to_liquid/converter.rb

Constant Summary collapse

ARRAY_EMPTY_CHECK_EXPRESSIONS =
[
  "courses",
  "course.instructors",
  "course.partnerships",
  "learning_path.instructors",
  "homepage.published_featured_courses",
  "learning_path.items",
  "current_person.filterable_catalog_categories",
  "current_person.filterable_learning_path_categories",
  "current_person.filterable_categories"
].freeze
ConversionError =
Class.new(StandardError)

Instance Method Summary collapse

Constructor Details

#initialize(body) ⇒ Converter

Returns a new instance of Converter.



18
19
20
21
# File 'lib/sktl_to_liquid/converter.rb', line 18

def initialize(body)
  @body = body
  @scope_stack = []
end

Instance Method Details

#convertObject



23
24
25
26
27
28
29
30
31
# File 'lib/sktl_to_liquid/converter.rb', line 23

def convert
  liquid_template = ""

  template.parse[:template].each do |segment|
    liquid_template += convert_toplevel(segment)
  end

  post_process(liquid_template)
end