Module: Cecil::Code::Helpers

Included in:
Lang::TypeScript::Helpers
Defined in:
lib/cecil/code.rb

Overview

Subclasses of Cecil::Code can define a module named Helpers and add methods to it that will be available inside a Cecil block for that subclass.

When defining your own Helpers module, if you want your parent class' helper methods, then include your parent class' Helpers module in yours, like this:

class CSS < Code::Syntax
  module Helpers
    include Code::Syntax::Helpers

    def data_uri(file) = DataURI.from_file(file) # this is made up, not working code

  end
end

class SCSS < CSS
  module Helpers
    include CSS::Helpers # now `data_uri` will be an available helper
  end
end

Subclasses that don't define a Helpers module inherit the one from their parent class.