class TPPlus::Nodes::PosregNode

Constants

COMPONENTS
GROUPS

Attributes

comment[RW]
id[R]

Public Class Methods

new(id) click to toggle source
# File lib/tp_plus/nodes/posreg_node.rb, line 24
def initialize(id)
  @id = id
  @comment = ""
end

Public Instance Methods

comment_string() click to toggle source
# File lib/tp_plus/nodes/posreg_node.rb, line 29
def comment_string
  return "" if @comment == ""

  ":#{@comment}"
end
component(m) click to toggle source
# File lib/tp_plus/nodes/posreg_node.rb, line 35
def component(m)
  return "" if m == ""

  ",#{COMPONENTS[m]}"
end
component_groups?(c) click to toggle source
# File lib/tp_plus/nodes/posreg_node.rb, line 45
def component_groups?(c)
  [""].concat(GROUPS.keys).include? c
end
component_valid?(c) click to toggle source
# File lib/tp_plus/nodes/posreg_node.rb, line 41
def component_valid?(c)
  [""].concat(COMPONENTS.keys).include? c
end
eval(context,options={}) click to toggle source
# File lib/tp_plus/nodes/posreg_node.rb, line 53
def eval(context,options={})
  options[:method] ||= ""

  group_string = GROUPS["gp" + options[:group].eval(context).to_s] + ":" if options[:group]

  raise "Invalid component" unless component_valid?(options[:method]) || component_groups?(options[:group])

  "PR[#{group_string}#{@id}#{component(options[:method])}#{comment_string}]"
end
requires_mixed_logic?(context) click to toggle source
# File lib/tp_plus/nodes/posreg_node.rb, line 49
def requires_mixed_logic?(context)
  false
end