Class: Fable::ChoicePoint

Inherits:
RuntimeObject show all
Defined in:
lib/fable/choice_point.rb

Instance Attribute Summary collapse

Attributes inherited from RuntimeObject

#original_object, #own_debug_metadata, #parent, #path

Instance Method Summary collapse

Methods inherited from RuntimeObject

#compact_path_string, #convert_path_to_relative, #copy, #debug_line_number_of_path, #debug_metadata, #indentation_string, #initialize, #resolve_path, #root_content_container

Constructor Details

This class inherits a constructor from Fable::RuntimeObject

Instance Attribute Details

#has_choice_only_contentObject Also known as: has_choice_only_content?

Returns the value of attribute has_choice_only_content.



3
4
5
# File 'lib/fable/choice_point.rb', line 3

def has_choice_only_content
  @has_choice_only_content
end

#has_conditionObject Also known as: has_condition?

Returns the value of attribute has_condition.



3
4
5
# File 'lib/fable/choice_point.rb', line 3

def has_condition
  @has_condition
end

#has_start_contentObject Also known as: has_start_content?

Returns the value of attribute has_start_content.



3
4
5
# File 'lib/fable/choice_point.rb', line 3

def has_start_content
  @has_start_content
end

#invisible_defaultObject Also known as: invisible_default?

Returns the value of attribute invisible_default.



3
4
5
# File 'lib/fable/choice_point.rb', line 3

def invisible_default
  @invisible_default
end

#once_onlyObject Also known as: once_only?

Returns the value of attribute once_only.



3
4
5
# File 'lib/fable/choice_point.rb', line 3

def once_only
  @once_only
end

#path_on_choiceObject

The ChoicePoint represents the point within the Story where a Choice instance gets generated. The distinction is made because the text of the choice can be dynamically generated



18
19
20
# File 'lib/fable/choice_point.rb', line 18

def path_on_choice
  @path_on_choice
end

Instance Method Details

#choice_targetObject



34
35
36
# File 'lib/fable/choice_point.rb', line 34

def choice_target
  self.resolve_path(@path_on_choice).container
end

#flags=(flag) ⇒ Object



46
47
48
49
50
51
52
# File 'lib/fable/choice_point.rb', line 46

def flags=(flag)
  self.has_condition = (flag & 1) > 0
  self.has_start_content = (flag & 2) > 0
  self.has_choice_only_content = (flag & 4) > 0
  self.invisible_default = (flag & 8) > 0
  self.once_only = (flag & 16) > 0
end

#path_string_on_choiceObject



38
39
40
# File 'lib/fable/choice_point.rb', line 38

def path_string_on_choice
  compact_path_string(path_on_choice)
end

#path_string_on_choice=(value) ⇒ Object



42
43
44
# File 'lib/fable/choice_point.rb', line 42

def path_string_on_choice=(value)
  self.path_on_choice = Path.new(value)
end

#to_sObject



54
55
56
57
58
59
60
61
62
63
# File 'lib/fable/choice_point.rb', line 54

def to_s
  target_line_number = debug_line_number_of_path(path_on_choice)
  target_string = path_on_choice.to_s

  if !target_line_number.nil?
    target_string = " line #{target_line_number} (#{target_string})"
  end

  return "Choice: -> #{target_string}"
end