Methods

Included Modules

RText::ContextBuilder

The ContextBuilder builds context information for a set of context lines and the cursor position in the current line. The context consists of

Public Class Methods

build_context(language, context_lines, position_in_line) click to toggle source

Builds the context information based on a set of content_lines. Content lines are the RText lines containing the nested command headers in the original order. The cursor is assumed to be in the last context line at column position_in_line

# File lib/rtext/context_builder.rb, line 37
def build_context(language, context_lines, position_in_line)
  context_info = fix_context(language, context_lines, position_in_line)
  return nil unless context_info
  element = instantiate_context_element(language, context_info)
  if element
    after_label = false
    if context_info.role
      if context_info.role.is_a?(Integer)
        feature = language.unlabled_arguments(element.class.ecore)[context_info.role] 
      else
        feature = element.class.ecore.eAllStructuralFeatures.find{|f| f.name == context_info.role}
        after_label = true
      end
    else
      feature = nil
    end
    Context.new(element, feature, context_info.prefix, context_info.in_array, context_info.in_block, after_label, context_info.problem)
  else
    Context.new(nil, nil, context_info.prefix, context_info.in_array, context_info.in_block, false, context_info.problem)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.