Class: SFRP::Raw::Infix

Inherits:
Struct
  • Object
show all
Defined in:
lib/sfrp/raw/elements.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#directionObject

Returns the value of attribute direction

Returns:

  • (Object)

    the current value of direction



122
123
124
# File 'lib/sfrp/raw/elements.rb', line 122

def direction
  @direction
end

#func_refObject

Returns the value of attribute func_ref

Returns:

  • (Object)

    the current value of func_ref



122
123
124
# File 'lib/sfrp/raw/elements.rb', line 122

def func_ref
  @func_ref
end

#nsObject

Returns the value of attribute ns

Returns:

  • (Object)

    the current value of ns



122
123
124
# File 'lib/sfrp/raw/elements.rb', line 122

def ns
  @ns
end

#priorityObject

Returns the value of attribute priority

Returns:

  • (Object)

    the current value of priority



122
123
124
# File 'lib/sfrp/raw/elements.rb', line 122

def priority
  @priority
end

#spObject

Returns the value of attribute sp

Returns:

  • (Object)

    the current value of sp



122
123
124
# File 'lib/sfrp/raw/elements.rb', line 122

def sp
  @sp
end

Instance Method Details

#absolute_func_name(set) ⇒ Object

Raises:



125
126
127
128
129
# File 'lib/sfrp/raw/elements.rb', line 125

def absolute_func_name(set)
  func_name = set.func(ns, func_ref, sp).absolute_name
  raise NameError.new(func_ref.to_s, sp) unless func_name
  func_name
end

#absolute_priority(position) ⇒ Object



131
132
133
134
135
136
137
138
139
140
# File 'lib/sfrp/raw/elements.rb', line 131

def absolute_priority(position)
  case direction
  when LEFT
    [priority, 1000 - position]
  when RIGHT
    [priority, position]
  when NONE
    [priority, 0]
  end
end