class Inkcite::View::Context

Private class used to convey view attributes to the Erubis rendering engine without exposing all of the view's attributes.

Constants

QUESTION_MARK
UNDERSCORE

Public Class Methods

new(view) click to toggle source
# File lib/inkcite/view/context.rb, line 10
def initialize view
  @view = view
end

Public Instance Methods

method_missing(m, *args, &block) click to toggle source
# File lib/inkcite/view/context.rb, line 14
def method_missing(m, *args, &block)
  if m[-1] == QUESTION_MARK
    start_at = m[0] == UNDERSCORE ? 1 : 0
    symbol = m[start_at, m.length - (start_at + 1)].to_sym

    @view.version == symbol
  else

    # Check for variables/helpers when an unknown token
    # is encountered.  Allows for accessing values defined
    # in helper.tsv directly in ERB code.
    config_value = @view[m]

  end
end

Protected Instance Methods

view() click to toggle source
# File lib/inkcite/view/context.rb, line 32
def view
  @view
end