diff --git a/doc/Dialogue.html b/doc/Dialogue.html index a236f14..bf6102a 100644 --- a/doc/Dialogue.html +++ b/doc/Dialogue.html @@ -111,14 +111,273 @@ + +

+ Class Method Summary + collapse +

+ + + + + +
+

Class Method Details

+ + +
+

+ + .display_branch(branch, branch_no, debug = false) ⇒ Object + + + + + +

+
+ +

Format and display a branch and the options

+ + +
+
+
+

Parameters:

+
    + +
  • + + branch + + + (Hash) + + + + — +
    +

    A branch data set

    +
    + +
  • + +
  • + + branch_no + + + (Integer) + + + + — +
    +

    The branch number

    +
    + +
  • + +
  • + + debug + + + (Boolean) + + + (defaults to: false) + + + — +
    +

    Status of showing debug information

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+23
+24
+25
+26
+27
+28
+29
+30
+31
+
+
# File 'lib/sapling/dialogue.rb', line 23
+
+def self.display_branch(branch, branch_no, debug=false)
+  puts "\n[ Branch: #{branch_no} ]" if debug
+  puts "\n#{branch["desc"]}\n\n"
+
+  branch["options"].each_pair do |k,v|
+    puts "\t#{k}: #{v.keys[0]}"
+    puts "\t\t[ Goes to branch #{v.values[0]} ]\n" if debug
+  end
+end
+
+
+ +
+

+ + .display_trunk(trunk, debug = false) ⇒ Object + + + + + +

+
+ +

Format and display the trunk

+ + +
+
+
+

Parameters:

+
    + +
  • + + trunk + + + (Hash) + + + + — +
    +

    The trunk hash

    +
    + +
  • + +
  • + + debug + + + (Boolean) + + + (defaults to: false) + + + — +
    +

    The status of showing debug information

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+10
+11
+12
+13
+14
+15
+16
+
+
# File 'lib/sapling/dialogue.rb', line 10
+
+def self.display_trunk(trunk, debug=false)
+  40.times { print "-" }
+  puts "\n[ Trunk ]\n" if debug
+  puts "\n#{trunk["trunk"]}"
+  40.times { print "-" }
+  puts "\n"
+end
+
+
+ +
diff --git a/doc/Dialogue/Speaker.html b/doc/Dialogue/Speaker.html index 3bd027f..3e9ed52 100644 --- a/doc/Dialogue/Speaker.html +++ b/doc/Dialogue/Speaker.html @@ -102,8 +102,7 @@

Overview

-

Spealer holds the functionality for viewing and going through a dialogue -tree.

+

Speaker holds the functionality for going through a dialogue tree.

@@ -213,7 +212,31 @@ reached.

  • - #initialize ⇒ Speaker + #get_response(branch) ⇒ Integer + + + + + + + + + + + + + +
    +

    Get a response for the displayed branch.

    +
    + +
  • + + +
  • + + + #initialize(file = "", debug = false) ⇒ Speaker @@ -239,7 +262,7 @@ reached.

  • - #talk(branch) ⇒ Integer + #talk(branch, branch_no) ⇒ Integer @@ -269,7 +292,7 @@ reached.

    - #initializeSpeaker + #initialize(file = "", debug = false) ⇒ Speaker @@ -292,17 +315,17 @@ reached.

     
     
    -15
    -16
    -17
    -18
    +40 +41 +42 +43 -
    # File 'lib/sapling/dialogue.rb', line 15
    +      
    # File 'lib/sapling/dialogue.rb', line 40
     
    -def initialize
    -  @file = ""
    -  @debug = false
    +def initialize(file="", debug=false)
    +  @file = file
    +  @debug = debug
     end
    @@ -342,12 +365,12 @@ reached.

     
     
    -13
    -14
    -15
    +38 +39 +40
    -
    # File 'lib/sapling/dialogue.rb', line 13
    +      
    # File 'lib/sapling/dialogue.rb', line 38
     
     def debug
       @debug
    @@ -385,12 +408,12 @@ reached.

     
     
    -10
    -11
    -12
    +36 +37 +38
    -
    # File 'lib/sapling/dialogue.rb', line 10
    +      
    # File 'lib/sapling/dialogue.rb', line 36
     
     def file
       @file
    @@ -434,36 +457,36 @@ reached.

     
     
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60
    -
    # File 'lib/sapling/dialogue.rb', line 22
    +      
    # File 'lib/sapling/dialogue.rb', line 47
     
     def conversation()
    -  tree = Gardner.grow(@file)
    +  tree = Gardner.prune_trunk(@file)
     
    -  10.times { print "*" }
    -  puts "\n[ Branch: 1 ]" if @debug
    -  next_branch = talk(tree[1])
    +  Dialogue.display_trunk(tree[0], false)
    +  branches = Gardner.prune_branches(tree[1])
    +
    +  next_branch = 1
       until next_branch == 0 do
    -    puts "\n[ Branch: #{next_branch} ]" if @debug
    -    next_branch = talk(tree[next_branch])
    +    next_branch = talk(branches[next_branch], next_branch)
       end
     
    -  puts "\n#{tree[0]["desc"]}"
    +  puts "\n#{branches[0]["desc"]}"
       exit
     end
    @@ -472,9 +495,9 @@ reached.

    -

    +

    - #talk(branch) ⇒ Integer + #get_response(branch) ⇒ Integer @@ -483,7 +506,7 @@ reached.

    -

    Talk displays a branch, the options, and prompts for a response

    +

    Get a response for the displayed branch

    @@ -520,6 +543,127 @@ reached.

    + — +
    +

    the next branch

    +
    + +
  • + + + +
    + + + + +
    +
    +
    +
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +
    +
    # File 'lib/sapling/dialogue.rb', line 93
    +
    +def get_response(branch)
    +  valid_options = branch["options"].keys.join(", ")
    +
    +  print "\n[#{valid_options}]> "
    +  STDOUT.flush
    +  response = STDIN.gets.chomp.to_i
    +
    +  until branch["options"].keys.include?(response) or response == 0
    +    print "[## Invalid options. "
    +    print "Valid options are #{valid_options}, or 0 to exit."
    +    print "\n[#{valid_options}]> "
    +    response = STDIN.gets.chomp.to_i
    +  end
    +
    +  return response
    +end
    +
    + + +
    +

    + + #talk(branch, branch_no) ⇒ Integer + + + + + +

    +
    + +

    Talk displays a branch, the options, and prompts for a response.

    + + +
    +
    +
    +

    Parameters:

    + + +

    Returns:

    +
    diff --git a/doc/Gardner.html b/doc/Gardner.html index 8934804..7e953a8 100644 --- a/doc/Gardner.html +++ b/doc/Gardner.html @@ -112,30 +112,6 @@
  • - .grow(tree) ⇒ Hash - - - - - - - - - - - - - -
    -

    The main method for Sapling.

    -
    - -
  • - - -
  • - - .prune_branches(tree) ⇒ Array @@ -151,7 +127,8 @@
    -

    Parse the branch.

    +

    Parse the tree array into an array of numbered branches, and ordered +leaves.

  • @@ -175,7 +152,7 @@
    -

    Parse the options.

    +

    Parse the leaves of a branch into a numbered hash of options.

    @@ -184,7 +161,7 @@
  • - .prune_trunk(tree) ⇒ Hash + .prune_trunk(tree) ⇒ Array @@ -199,7 +176,7 @@
    -

    Parse the trunk The trunk is like the introduction to the tree.

    +

    Parse the trunk of the tree.

  • @@ -215,92 +192,7 @@
    -

    - - .grow(tree) ⇒ Hash - - - - - -

    -
    - -

    The main method for Sapling. From here, the tree is grown.

    - - -
    -
    -
    -

    Parameters:

    -
      - -
    • - - tree - - - (File) - - - - — -
      -

      The dialogue tree file

      -
      - -
    • - -
    - -

    Returns:

    -
      - -
    • - - - (Hash) - - - - — -
      -

      The final, constructed data set

      -
      - -
    • - -
    - -
    - - - - -
    -
    -
    -
    -61
    -62
    -63
    -64
    -65
    -66
    -
    -
    # File 'lib/sapling/gardner.rb', line 61
    -
    -def self.grow(tree)
    -    trunk = Gardner.prune_trunk(tree)
    -    branches = Gardner.prune_branches(trunk)
    -
    -    return branches
    -end
    -
    -
    - -
    -

    +

    .prune_branches(tree) ⇒ Array @@ -311,7 +203,8 @@

    -

    Parse the branch

    +

    Parse the tree array into an array of numbered branches, and ordered +leaves.

    @@ -350,7 +243,7 @@ —
    -

    The array of options on the branch.

    +

    An array of numbered branches, with numbered leaves

    @@ -372,8 +265,7 @@ 16 17 18 -19 -20 +19
    # File 'lib/sapling/gardner.rb', line 10
    @@ -387,7 +279,6 @@
       end
     
       return branches
    -
     end
    @@ -406,7 +297,7 @@
    -

    Parse the options

    +

    Parse the leaves of a branch into a numbered hash of options.

    @@ -445,7 +336,7 @@ —
    -

    A has of options

    +

    A numbered hash of options

    @@ -458,6 +349,7 @@
     
     
    +25
     26
     27
     28
    @@ -469,12 +361,10 @@
     34
     35
     36
    -37
    -38
    -39
    +37 -
    # File 'lib/sapling/gardner.rb', line 26
    +      
    # File 'lib/sapling/gardner.rb', line 25
     
     def self.prune_leaves(leaves)
       x = 1
    @@ -488,7 +378,6 @@
       end
     
       return options
    -
     end
    @@ -498,7 +387,7 @@

    - .prune_trunk(tree) ⇒ Hash + .prune_trunk(tree) ⇒ Array @@ -507,7 +396,7 @@

    -

    Parse the trunk The trunk is like the introduction to the tree.

    +

    Parse the trunk of the tree.

    @@ -540,13 +429,13 @@
  • - (Hash) + (Array)
    -

    The tree without the trunk

    +

    The trunk, and the remainder of the tree

  • @@ -559,29 +448,19 @@
     
     
    +43
    +44
    +45
     46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    +47
    -
    # File 'lib/sapling/gardner.rb', line 46
    +      
    # File 'lib/sapling/gardner.rb', line 43
     
     def self.prune_trunk(tree)
       trunk = tree.shift
    -  40.times { print "-" }
    -  puts "\n#{trunk["trunk"]}"
    -  40.times { print "-" }
    -  puts "\n"
    -
    -  return tree
     
    +  return [trunk,tree]
     end
    @@ -593,9 +472,9 @@
    diff --git a/doc/Planter.html b/doc/Planter.html index ae43cdd..9751f5c 100644 --- a/doc/Planter.html +++ b/doc/Planter.html @@ -116,9 +116,9 @@
    diff --git a/doc/Planter/Plot.html b/doc/Planter/Plot.html index d13ec89..9f5851a 100644 --- a/doc/Planter/Plot.html +++ b/doc/Planter/Plot.html @@ -99,8 +99,19 @@ +

    Overview

    +
    + +

    In-memory tree

    +
    +
    +
    + + +
    +

    Instance Attribute Summary collapse

    @@ -192,6 +203,89 @@ + +

    + Instance Method Summary + collapse +

    + + + +

    Instance Attribute Details

    @@ -224,12 +318,12 @@
     
     
    -10
    -11
    -12
    +12 +13 +14 -
    # File 'lib/sapling/planter.rb', line 10
    +      
    # File 'lib/sapling/planter.rb', line 12
     
     def branches
       @branches
    @@ -267,12 +361,12 @@
           
     
     
    -10
    -11
    -12
    +12 +13 +14
    -
    # File 'lib/sapling/planter.rb', line 10
    +      
    # File 'lib/sapling/planter.rb', line 12
     
     def tree
       @tree
    @@ -310,12 +404,12 @@
           
     
     
    -10
    -11
    -12
    +12 +13 +14
    -
    # File 'lib/sapling/planter.rb', line 10
    +      
    # File 'lib/sapling/planter.rb', line 12
     
     def trunk
       @trunk
    @@ -328,12 +422,237 @@
       
    +
    +

    Instance Method Details

    + + +
    +

    + + #edit_branch(branch_no) ⇒ Object + + + + + +

    +
    + +

    Edit a branch on the tree

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + branch + + + (Integer) + + + + — +
      +

      The number of the branch to be edited.

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +
    +
    # File 'lib/sapling/planter.rb', line 32
    +
    +def edit_branch(branch_no)
    +  puts "Current Branch:\n"
    +  Dialogue.display_branch(@branches[branch_no], branch_no, true)
    +  print "\n[ =EDITING= ](CTRL-C to abort)> "
    +  STDOUT.flush
    +  begin
    +    new_branch = STDIN.gets.to_s
    +  rescue Interrupt
    +    puts "\n**Aborting edit**\n\n"
    +    new_branch = @branches[branch_no]["desc"]
    +  end
    +  @branches[branch_no]["desc"] = new_branch
    +end
    +
    +
    + +
    +

    + + #edit_leaf(branch, leaf) ⇒ Object + + + + + +

    +
    + +

    Edit a leaf on a branch, grasshopper

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + branch + + + (Integer) + + + + — +
      +

      The number of the branch to be edited.

      +
      + +
    • + +
    • + + leaf + + + (Hash) + + + + — +
      +

      The leaf hash to be edited.

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +50
    +51
    +52
    +
    +
    # File 'lib/sapling/planter.rb', line 50
    +
    +def edit_leaf(branch, leaf)
    +
    +end
    +
    +
    + +
    +

    + + #edit_trunkObject + + + + + +

    +
    + +

    Edit the trunk of the tree

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +
    +
    # File 'lib/sapling/planter.rb', line 15
    +
    +def edit_trunk
    +  puts "Current Trunk:\n"
    +  Dialogue.display_trunk(@trunk, true)
    +  print "\n[ =EDITING= ](CTRL-C to abort)> "
    +  STDOUT.flush
    +  begin
    +    new_trunk = STDIN.gets.to_s
    +  rescue Interrupt
    +    puts "\n**Aborting edit**\n\n"
    +    new_trunk = @trunk["trunk"]
    +  end
    +  @trunk["trunk"] = new_trunk
    +end
    +
    +
    + +
    + diff --git a/doc/Planter/Spade.html b/doc/Planter/Spade.html index 39dce54..f89eacd 100644 --- a/doc/Planter/Spade.html +++ b/doc/Planter/Spade.html @@ -186,7 +186,7 @@
  • - #edit_branch(branch) ⇒ Object + #get_response(branch) ⇒ Integer @@ -201,7 +201,7 @@
    -

    Edit a branch on the tree.

    +

    Get a response for the displayed branch.

  • @@ -210,13 +210,15 @@
  • - #edit_leaf(branch, leaf) ⇒ Object + #initialize(file) ⇒ Spade + constructor + @@ -225,7 +227,7 @@
    -

    Edit a leaf on a branch, grasshopper.

    +

    A new instance of Spade.

  • @@ -234,7 +236,7 @@
  • - #edit_trunk ⇒ Object + #parse_response(response, branch_no) ⇒ Integer @@ -249,7 +251,7 @@
    -

    Edit the trunk of the tree.

    +

    Parse the response from get_response.

  • @@ -273,8 +275,8 @@
    -

    Establish a new Plot, which is basically an object for storing information -for us.

    +

    Establish and populate a new Plot (in-memory tree), then control the flow +of editing the Plot.

    @@ -283,6 +285,51 @@ for us.

    +
    +

    Constructor Details

    + +
    +

    + + #initialize(file) ⇒ Spade + + + + + +

    +
    + +

    Returns a new instance of Spade

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +61
    +62
    +63
    +
    +
    # File 'lib/sapling/planter.rb', line 61
    +
    +def initialize(file)
    +  @file = file
    +end
    +
    +
    + +

    Instance Attribute Details

    @@ -315,12 +362,12 @@ for us.

     
     
    -18
    -19
    -20
    +59 +60 +61 -
    # File 'lib/sapling/planter.rb', line 18
    +      
    # File 'lib/sapling/planter.rb', line 59
     
     def file=(value)
       @file = value
    @@ -385,49 +432,31 @@ gone forever (until next time).

     
     
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97
    -
    # File 'lib/sapling/planter.rb', line 36
    +      
    # File 'lib/sapling/planter.rb', line 87
     
     def dig(branch_no)
       branch = @plot.branches[branch_no]
     
    -  # Print the trunk
    -  40.times { print "-" }
    -  puts "\n[ Trunk ]\n#{@plot.trunk}"
    -  40.times { print "-" }
    -  puts "\n"
    -  10.times { print "*" }
    +  Dialogue.display_trunk(@plot.trunk, true)
    +  Dialogue.display_branch(branch, branch_no, true)
     
    -  # Print the branch and options
    -  puts "\n[ Branch: #{branch_no} ]"
    -  puts "\n#{branch["desc"]}\n\n"
    -  unless branch["options"].empty?
    -    branch["options"].each_pair do |k,v|
    -      puts "\t#{k}: #{v.keys[0]}"
    -      puts "\t\t [ Goes to branch #{v.values[0]} ]"
    -    end
    -  end
    +  response = get_response(branch)
    +  to_branch = parse_response(response, branch_no)
    +
    +  return to_branch
     end
    @@ -435,9 +464,9 @@ gone forever (until next time).

    -

    +

    - #edit_branch(branch) ⇒ Object + #get_response(branch) ⇒ Integer @@ -446,7 +475,7 @@ gone forever (until next time).

    -

    Edit a branch on the tree

    +

    Get a response for the displayed branch

    @@ -460,96 +489,37 @@ gone forever (until next time).

    branch - (Integer) - - - - — -
    -

    The number of the branch to be edited.

    -
    - - - - - - -
    - - - - -
    -
    -
    -
    -65
    -66
    -67
    -
    -
    # File 'lib/sapling/planter.rb', line 65
    -
    -def edit_branch(branch)
    -
    -end
    -
    -
    - -
    -

    - - #edit_leaf(branch, leaf) ⇒ Object - - - - - -

    -
    - -

    Edit a leaf on a branch, grasshopper

    - - -
    -
    -
    -

    Parameters:

    - +

    Returns:

    +
    @@ -557,15 +527,45 @@ gone forever (until next time).

     
     
    -73
    -74
    -75
    +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 @@ -573,9 +573,9 @@ gone forever (until next time).

    -

    +

    - #edit_trunkObject + #parse_response(response, branch_no) ⇒ Integer @@ -584,13 +584,67 @@ gone forever (until next time).

    -

    Edit the trunk of the tree

    +

    Parse the response from get_response

    +

    Parameters:

    +
      +
    • + + response + + + (String) + + + + — +
      +

      The option selected

      +
      + +
    • + +
    • + + branch_no + + + (Integer) + + + + — +
      +

      The currently-displayed branch

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      the branch to display

      +
      + +
    • + +
    -
    # File 'lib/sapling/planter.rb', line 73
    +      
    # File 'lib/sapling/planter.rb', line 103
     
    -def edit_leaf(branch, leaf)
    +def get_response(branch)
    +  total_branches = @plot.branches.count - 1
    +  valid_options = ["1-#{total_branches}","t","a","b","x","l","s","q"]
    +  print_options = valid_options.join(",")
     
    +  print "\n[#{print_options}]> "
    +  STDOUT.flush
    +  response = STDIN.gets.chomp.to_s.downcase
    +
    +  until valid_options.include?(response) or response.to_i.between?(1,total_branches)
    +    print "[## Invalid response. "
    +    print "Valid options are #{print_options}"
    +    print "\n[#{print_options}]> "
    +    response = STDIN.gets.chomp.to_s.downcase
    +  end
    +
    +  return response
     end
    @@ -598,15 +652,95 @@ gone forever (until next time).

     
     
    -58
    -59
    -60
    +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 @@ -625,8 +759,8 @@ gone forever (until next time).

    -

    Establish a new Plot, which is basically an object for storing information -for us. From here, we start gardening.

    +

    Establish and populate a new Plot (in-memory tree), then control the flow +of editing the Plot

    @@ -640,25 +774,37 @@ for us. From here, we start gardening.

     
     
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80
    @@ -670,9 +816,9 @@ for us. From here, we start gardening.

    diff --git a/doc/Sapling.html b/doc/Sapling.html index 70266ba..ed2ef29 100644 --- a/doc/Sapling.html +++ b/doc/Sapling.html @@ -4,7 +4,7 @@ - Module: Sapling + Class: Sapling — Sapling Documentation @@ -59,13 +59,31 @@ <div class="clear"></div> </div> - <div id="content"><h1>Module: Sapling + <div id="content"><h1>Class: Sapling </h1> <div class="box_info"> + <dl> + <dt>Inherits:</dt> + <dd> + <span class="inheritName">Thor</span> + + <ul class="fullTree"> + <li>Object</li> + + <li class="next">Thor</li> + + <li class="next">Sapling</li> + + </ul> + <a href="#" class="inheritanceTree">show all</a> + + </dd> + </dl> + @@ -86,8 +104,7 @@ <h2>Overview</h2><div class="docstring"> <div class="discussion"> -<p>Sapling is the main module for the program. From here, the rest of the -world starts building.</p> +<p>The main Sapling interface.</p> </div> @@ -95,31 +112,275 @@ world starts building.</p> <div class="tags"> -</div><h2>Defined Under Namespace</h2> -<p class="children"> +</div> + + + + + + + <h2> + Instance Method Summary + <small><a href="#" class="summary_toggle">collapse</a></small> + </h2> + + <ul class="summary"> + + <li class="public "> + <span class="summary_signature"> + <a href="#edit-instance_method" title="#edit (instance method)">#<strong>edit</strong>(tree = '') ⇒ Object </a> + + + + </span> - - <strong class="classes">Classes:</strong> <span class='object_link'><a href="Sapling/CLI.html" title="Sapling::CLI (class)">CLI</a></span> - -</p> + + + + + + + + <span class="summary_desc"><div class='inline'></div></span> + +</li> + + + <li class="public "> + <span class="summary_signature"> + + <a href="#export-instance_method" title="#export (instance method)">#<strong>export</strong>(tree) ⇒ Object </a> + + + + </span> + + + + + + + + + + <span class="summary_desc"><div class='inline'></div></span> + +</li> + + + <li class="public "> + <span class="summary_signature"> + + <a href="#read-instance_method" title="#read (instance method)">#<strong>read</strong>(tree) ⇒ Object </a> + + + + </span> + + + + + + + + + + <span class="summary_desc"><div class='inline'></div></span> + +</li> + + + <li class="public "> + <span class="summary_signature"> + + <a href="#serve-instance_method" title="#serve (instance method)">#<strong>serve</strong>(tree) ⇒ Object </a> + + + + </span> + + + + + + + + + + <span class="summary_desc"><div class='inline'></div></span> + +</li> + + + </ul> + + + + <div id="instance_method_details" class="method_details_list"> + <h2>Instance Method Details</h2> + + + <div class="method_details first"> + <h3 class="signature first" id="edit-instance_method"> + + #<strong>edit</strong>(tree = '') ⇒ <tt>Object</tt> + + + + + +</h3><table class="source_code"> + <tr> + <td> + <pre class="lines"> +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/sapling.rb', line 19</span> + +<span class='kw'>def</span> <span class='id identifier rubyid_edit'>edit</span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> + <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Welcome to Sapling, a Dialogue Tree Utility.</span><span class='tstring_end'>'</span></span> + <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_tree'>tree</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> + <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Loading tree: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_tree'>tree</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> + <span class='id identifier rubyid_exit'>exit</span> <span class='kw'>unless</span> <span class='id identifier rubyid_verify_tree'><span class='object_link'><a href="top-level-namespace.html#verify_tree-instance_method" title="#verify_tree (method)">verify_tree</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span><span class='rparen'>)</span> + <span class='id identifier rubyid_gardner'>gardner</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Planter.html" title="Planter (module)">Planter</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Planter/Spade.html" title="Planter::Spade (class)">Spade</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Planter/Spade.html#initialize-instance_method" title="Planter::Spade#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='const'>YAML</span><span class='period'>.</span><span class='id identifier rubyid_load_file'>load_file</span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span><span class='rparen'>)</span> + <span class='kw'>else</span> + <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Creating a new tree!</span><span class='tstring_end'>'</span></span> + <span class='id identifier rubyid_gardner'>gardner</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Planter.html" title="Planter (module)">Planter</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Planter/Spade.html" title="Planter::Spade (class)">Spade</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Planter/Spade.html#initialize-instance_method" title="Planter::Spade#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="top-level-namespace.html#SKELETON_TREE-constant" title="SKELETON_TREE (constant)">SKELETON_TREE</a></span></span><span class='rparen'>)</span> + <span class='kw'>end</span> + <span class='id identifier rubyid_gardner'>gardner</span><span class='period'>.</span><span class='id identifier rubyid_plant'>plant</span> +<span class='kw'>end</span></pre> + </td> + </tr> +</table> +</div> + + <div class="method_details "> + <h3 class="signature " id="export-instance_method"> + + #<strong>export</strong>(tree) ⇒ <tt>Object</tt> + + + + + +</h3><table class="source_code"> + <tr> + <td> + <pre class="lines"> +39 +40 +41 +42</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/sapling.rb', line 39</span> + +<span class='kw'>def</span> <span class='id identifier rubyid_export'>export</span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span><span class='rparen'>)</span> + <span class='id identifier rubyid_exit'>exit</span> <span class='kw'>unless</span> <span class='id identifier rubyid_verify_tree'><span class='object_link'><a href="top-level-namespace.html#verify_tree-instance_method" title="#verify_tree (method)">verify_tree</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span><span class='rparen'>)</span> + <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Cool feature, bro!</span><span class='tstring_end'>'</span></span> +<span class='kw'>end</span></pre> + </td> + </tr> +</table> +</div> + + <div class="method_details "> + <h3 class="signature " id="read-instance_method"> + + #<strong>read</strong>(tree) ⇒ <tt>Object</tt> + + + + + +</h3><table class="source_code"> + <tr> + <td> + <pre class="lines"> +11 +12 +13 +14 +15 +16</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/sapling.rb', line 11</span> + +<span class='kw'>def</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span><span class='rparen'>)</span> + <span class='id identifier rubyid_exit'>exit</span> <span class='kw'>unless</span> <span class='id identifier rubyid_verify_tree'><span class='object_link'><a href="top-level-namespace.html#verify_tree-instance_method" title="#verify_tree (method)">verify_tree</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span><span class='rparen'>)</span> + <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Welcome to Sapling, a Dialogue Tree Utility.</span><span class='tstring_end'>'</span></span> + <span class='id identifier rubyid_speaker'>speaker</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Dialogue.html" title="Dialogue (module)">Dialogue</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Dialogue/Speaker.html" title="Dialogue::Speaker (class)">Speaker</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Dialogue/Speaker.html#initialize-instance_method" title="Dialogue::Speaker#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='const'>YAML</span><span class='period'>.</span><span class='id identifier rubyid_load_file'>load_file</span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span> + <span class='id identifier rubyid_speaker'>speaker</span><span class='period'>.</span><span class='id identifier rubyid_conversation'>conversation</span> +<span class='kw'>end</span></pre> + </td> + </tr> +</table> +</div> + + <div class="method_details "> + <h3 class="signature " id="serve-instance_method"> + + #<strong>serve</strong>(tree) ⇒ <tt>Object</tt> + + + + + +</h3><table class="source_code"> + <tr> + <td> + <pre class="lines"> + + +33 +34 +35 +36</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/sapling.rb', line 33</span> + +<span class='kw'>def</span> <span class='id identifier rubyid_serve'>serve</span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span><span class='rparen'>)</span> + <span class='id identifier rubyid_exit'>exit</span> <span class='kw'>unless</span> <span class='id identifier rubyid_verify_tree'><span class='object_link'><a href="top-level-namespace.html#verify_tree-instance_method" title="#verify_tree (method)">verify_tree</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span><span class='rparen'>)</span> + <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Sinatra will be cool.</span><span class='tstring_end'>'</span></span> +<span class='kw'>end</span></pre> + </td> + </tr> +</table> +</div> + + </div> </div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> diff --git a/doc/_index.html b/doc/_index.html index 86da46c..ae95d40 100644 --- a/doc/_index.html +++ b/doc/_index.html @@ -93,21 +93,6 @@ <td valign='top' width="33%"> - <ul id="alpha_C" class="alpha"> - <li class="letter">C</li> - <ul> - - <li> - <span class='object_link'><a href="Sapling/CLI.html" title="Sapling::CLI (class)">CLI</a></span> - - <small>(Sapling)</small> - - </li> - - </ul> - </ul> - - <ul id="alpha_D" class="alpha"> <li class="letter">D</li> <ul> @@ -159,7 +144,7 @@ <ul> <li> - <span class='object_link'><a href="Sapling.html" title="Sapling (module)">Sapling</a></span> + <span class='object_link'><a href="Sapling.html" title="Sapling (class)">Sapling</a></span> </li> @@ -189,9 +174,9 @@ </div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> diff --git a/doc/class_list.html b/doc/class_list.html index 4edf910..728036b 100644 --- a/doc/class_list.html +++ b/doc/class_list.html @@ -43,7 +43,7 @@ <ul id="full_list" class="class"> <li id="object_" class="odd"><div class="item" style="padding-left:30px"><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></div></li> -<li id='object_Dialogue' class='even'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Dialogue.html" title="Dialogue (module)">Dialogue</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Dialogue::Speaker' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Dialogue/Speaker.html" title="Dialogue::Speaker (class)">Speaker</a></span> < Object<small class='search_info'>Dialogue</small></div></li></ul></li><li id='object_Gardner' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Gardner.html" title="Gardner (module)">Gardner</a></span><small class='search_info'>Top Level Namespace</small></div></li><li id='object_Planter' class='odd'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Planter.html" title="Planter (module)">Planter</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Planter::Plot' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Planter/Plot.html" title="Planter::Plot (class)">Plot</a></span> < Object<small class='search_info'>Planter</small></div></li><li id='object_Planter::Spade' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Planter/Spade.html" title="Planter::Spade (class)">Spade</a></span> < Object<small class='search_info'>Planter</small></div></li></ul></li><li id='object_Sapling' class='even'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Sapling.html" title="Sapling (module)">Sapling</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Sapling::CLI' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Sapling/CLI.html" title="Sapling::CLI (class)">CLI</a></span> < Object<small class='search_info'>Sapling</small></div></li></ul></li> +<li id='object_Dialogue' class='even'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Dialogue.html" title="Dialogue (module)">Dialogue</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Dialogue::Speaker' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Dialogue/Speaker.html" title="Dialogue::Speaker (class)">Speaker</a></span> < Object<small class='search_info'>Dialogue</small></div></li></ul></li><li id='object_Gardner' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Gardner.html" title="Gardner (module)">Gardner</a></span><small class='search_info'>Top Level Namespace</small></div></li><li id='object_Planter' class='odd'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Planter.html" title="Planter (module)">Planter</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Planter::Plot' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Planter/Plot.html" title="Planter::Plot (class)">Plot</a></span> < Object<small class='search_info'>Planter</small></div></li><li id='object_Planter::Spade' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Planter/Spade.html" title="Planter::Spade (class)">Spade</a></span> < Object<small class='search_info'>Planter</small></div></li></ul></li><li id='object_Sapling' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Sapling.html" title="Sapling (class)">Sapling</a></span> < Thor<small class='search_info'>Top Level Namespace</small></div></li> </ul> </div> diff --git a/doc/file.CONTRIBUTING.html b/doc/file.CONTRIBUTING.html index 9b7f6a2..0a3c9da 100644 --- a/doc/file.CONTRIBUTING.html +++ b/doc/file.CONTRIBUTING.html @@ -74,9 +74,9 @@ feel free to submit an issue or reach out to me directly.</p> </div></div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> diff --git a/doc/file.LICENSE.html b/doc/file.LICENSE.html index 70625c3..0349eb2 100644 --- a/doc/file.LICENSE.html +++ b/doc/file.LICENSE.html @@ -82,9 +82,9 @@ DEALINGS IN THE SOFTWARE.</p> </div></div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> diff --git a/doc/file.README.html b/doc/file.README.html index 1ab7dc9..253301c 100644 --- a/doc/file.README.html +++ b/doc/file.README.html @@ -59,6 +59,10 @@ <div id="content"><div id='filecontents'><h1>Sapling: A Dialogue Tree CLI Utility</h1> +<p><a href="https://badge.fury.io/rb/sapling-dialogue"><img src="https://badge.fury.io/rb/sapling-dialogue.svg" alt="Gem +Version"></a> <a href="https://travis-ci.org/VagabondAzulien/sapling"><img src="https://travis-ci.org/VagabondAzulien/sapling.svg?branch=master" alt="Build +Status"></a></p> + <p>Sapling allows for easy creation and use of dialogue trees.</p> <p>A dialogue tree is a series of dialogues which follow sequentially, though with @@ -75,25 +79,25 @@ branch represents a choice taken in the dialogue. Branches flow to each other through leafs, which are the actual choices.</p> <p>You can experience this yourself, by loading "Example Quest! - A Meta Dialogue -Tree!". You can find the tree itself at <a href="var/trees/example_quest.yaml">trees/example_quest.yaml</a>. To run it, just type <code>sapling -t -trees/example_quest.yaml</code>.</p> +Tree!". You can find the tree itself at <a href="https://github.com/VagabondAzulien/sapling/blob/master/var/trees/example_quest.yaml">var/trees/example_quest.yaml</a>. +To run it, just type <code>sapling read path/to/example_quest.yaml</code>.</p> <h2>Building a New Tree</h2> <p>To build a new tree, you have two options. You can manually edit a configuration file, or go through the construction wizard. Either way, the end result is a plain-text configuration file, which can be easily shared, edited, and viewed. -For more details on the configuration file itself, check out the <a href="var/docs/config_file.md">Configuration -File documentation</a>, or the self-documented -<a href="var/docs/config_file_example.yaml">configuration file example</a>. Alternatively, -you can checkout <a href="var/trees/example_quest.yaml">Example Quest</a> for a complete -tree.</p> +For more details on the configuration file itself, check out the <a href="http://www.theinternetvagabond.com/sapling/file.config_file.html">Configuration +File documentation</a>, or the +self-documented <a href="http://www.theinternetvagabond.com/sapling/file.config_file_example.html">configuration file example</a>. +Alternatively, you can checkout <a href="https://github.com/VagabondAzulien/sapling/blob/master/var/trees/example_quest.yaml">Example Quest</a> +for a complete tree.</p> <h3>Manual Edit</h3> <ol> <li>Open your preferred text editor.</li> -<li>Refer to the <a href="var/docs/config_file.md">Configuration File documentation</a></li> +<li>Refer to the <a href="http://www.theinternetvagabond.com/sapling/file.config_file.html">Configuration File documentation</a></li> <li>Make your changes.</li> <li>Save your changes.</li> </ol> @@ -101,16 +105,16 @@ tree.</p> <h3>Automatic Edit -- Coming Soon(tm)!</h3> <ol> -<li>Run the configuration editor: <code>sapling --edit [--new][--file FILE]</code></li> -<li>If you choose to create a new dialogue, <code>sapling</code> will generate a new file in -your current directory.</li> +<li>Run the configuration editor: <code>sapling edit [TREE]</code></li> +<li>If you don't include a TREE, <code>sapling</code> will create a new tree in the current +directory.</li> <li>If you choose to modify an existing file, <code>sapling</code> will open the tree at the trunk, and show you the first branch.</li> <li>Make your changes.</li> <li>Save your changes.</li> </ol> -<p>More details on the editor can be found in the <a href="var/docs/editor.md">Editor +<p>More details on the editor can be found in the <a href="http://www.theinternetvagabond.com/sapling/file.editor.html">Editor documentation</a>.</p> <h2>Contributing</h2> @@ -120,7 +124,7 @@ documentation</a>.</p> <ol> <li>Fork this repository.</li> <li>In your fork, make your changes.</li> -<li>Make sure your changes respect the <a href="CONTRIBUTING.md">contribution +<li>Make sure your changes respect the <a href="http://www.theinternetvagabond.com/sapling/file.CONTRIBUTING.html">contribution guidelines</a>.</li> <li>Submit a pull request.</li> </ol> @@ -128,13 +132,13 @@ guidelines</a>.</li> <h2>License</h2> <p>Sapling is licensed under the MIT license. The full text can be found in -<a href="LICENSE">LICENSE</a>.</p> +<a href="http://www.theinternetvagabond.com/sapling/file.LICENSE.html">LICENSE</a>.</p> </div></div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> diff --git a/doc/file.config_file.html b/doc/file.config_file.html index 03a9d92..725b618 100644 --- a/doc/file.config_file.html +++ b/doc/file.config_file.html @@ -126,9 +126,9 @@ branch", and the program will end after reaching it.</li> </div></div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> diff --git a/doc/file.config_file_example.html b/doc/file.config_file_example.html index 9374e60..e72c020 100644 --- a/doc/file.config_file_example.html +++ b/doc/file.config_file_example.html @@ -100,9 +100,9 @@ </div></div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> diff --git a/doc/file.editor.html b/doc/file.editor.html index f2263ab..ce01b15 100644 --- a/doc/file.editor.html +++ b/doc/file.editor.html @@ -72,9 +72,9 @@ allows for editing all parts of a tree, from the trunk to the leaves.</p> </div></div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> diff --git a/doc/index.html b/doc/index.html index 5348f78..19a6d47 100644 --- a/doc/index.html +++ b/doc/index.html @@ -59,6 +59,10 @@ <div id="content"><div id='filecontents'><h1>Sapling: A Dialogue Tree CLI Utility</h1> +<p><a href="https://badge.fury.io/rb/sapling-dialogue"><img src="https://badge.fury.io/rb/sapling-dialogue.svg" alt="Gem +Version"></a> <a href="https://travis-ci.org/VagabondAzulien/sapling"><img src="https://travis-ci.org/VagabondAzulien/sapling.svg?branch=master" alt="Build +Status"></a></p> + <p>Sapling allows for easy creation and use of dialogue trees.</p> <p>A dialogue tree is a series of dialogues which follow sequentially, though with @@ -75,25 +79,25 @@ branch represents a choice taken in the dialogue. Branches flow to each other through leafs, which are the actual choices.</p> <p>You can experience this yourself, by loading "Example Quest! - A Meta Dialogue -Tree!". You can find the tree itself at <a href="var/trees/example_quest.yaml">trees/example_quest.yaml</a>. To run it, just type <code>sapling -t -trees/example_quest.yaml</code>.</p> +Tree!". You can find the tree itself at <a href="https://github.com/VagabondAzulien/sapling/blob/master/var/trees/example_quest.yaml">var/trees/example_quest.yaml</a>. +To run it, just type <code>sapling read path/to/example_quest.yaml</code>.</p> <h2>Building a New Tree</h2> <p>To build a new tree, you have two options. You can manually edit a configuration file, or go through the construction wizard. Either way, the end result is a plain-text configuration file, which can be easily shared, edited, and viewed. -For more details on the configuration file itself, check out the <a href="var/docs/config_file.md">Configuration -File documentation</a>, or the self-documented -<a href="var/docs/config_file_example.yaml">configuration file example</a>. Alternatively, -you can checkout <a href="var/trees/example_quest.yaml">Example Quest</a> for a complete -tree.</p> +For more details on the configuration file itself, check out the <a href="http://www.theinternetvagabond.com/sapling/file.config_file.html">Configuration +File documentation</a>, or the +self-documented <a href="http://www.theinternetvagabond.com/sapling/file.config_file_example.html">configuration file example</a>. +Alternatively, you can checkout <a href="https://github.com/VagabondAzulien/sapling/blob/master/var/trees/example_quest.yaml">Example Quest</a> +for a complete tree.</p> <h3>Manual Edit</h3> <ol> <li>Open your preferred text editor.</li> -<li>Refer to the <a href="var/docs/config_file.md">Configuration File documentation</a></li> +<li>Refer to the <a href="http://www.theinternetvagabond.com/sapling/file.config_file.html">Configuration File documentation</a></li> <li>Make your changes.</li> <li>Save your changes.</li> </ol> @@ -101,16 +105,16 @@ tree.</p> <h3>Automatic Edit -- Coming Soon(tm)!</h3> <ol> -<li>Run the configuration editor: <code>sapling --edit [--new][--file FILE]</code></li> -<li>If you choose to create a new dialogue, <code>sapling</code> will generate a new file in -your current directory.</li> +<li>Run the configuration editor: <code>sapling edit [TREE]</code></li> +<li>If you don't include a TREE, <code>sapling</code> will create a new tree in the current +directory.</li> <li>If you choose to modify an existing file, <code>sapling</code> will open the tree at the trunk, and show you the first branch.</li> <li>Make your changes.</li> <li>Save your changes.</li> </ol> -<p>More details on the editor can be found in the <a href="var/docs/editor.md">Editor +<p>More details on the editor can be found in the <a href="http://www.theinternetvagabond.com/sapling/file.editor.html">Editor documentation</a>.</p> <h2>Contributing</h2> @@ -120,7 +124,7 @@ documentation</a>.</p> <ol> <li>Fork this repository.</li> <li>In your fork, make your changes.</li> -<li>Make sure your changes respect the <a href="CONTRIBUTING.md">contribution +<li>Make sure your changes respect the <a href="http://www.theinternetvagabond.com/sapling/file.CONTRIBUTING.html">contribution guidelines</a>.</li> <li>Submit a pull request.</li> </ol> @@ -128,13 +132,13 @@ guidelines</a>.</li> <h2>License</h2> <p>Sapling is licensed under the MIT license. The full text can be found in -<a href="LICENSE">LICENSE</a>.</p> +<a href="http://www.theinternetvagabond.com/sapling/file.LICENSE.html">LICENSE</a>.</p> </div></div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> diff --git a/doc/method_list.html b/doc/method_list.html index a22cb7c..52443d6 100644 --- a/doc/method_list.html +++ b/doc/method_list.html @@ -78,24 +78,56 @@ <li class="odd "> <div class="item"> - <span class='object_link'><a href="Planter/Spade.html#edit_branch-instance_method" title="Planter::Spade#edit_branch (method)">#edit_branch</a></span> - <small>Planter::Spade</small> + <span class='object_link'><a href="Dialogue.html#display_branch-class_method" title="Dialogue.display_branch (method)">display_branch</a></span> + <small>Dialogue</small> </div> </li> <li class="even "> <div class="item"> - <span class='object_link'><a href="Planter/Spade.html#edit_leaf-instance_method" title="Planter::Spade#edit_leaf (method)">#edit_leaf</a></span> - <small>Planter::Spade</small> + <span class='object_link'><a href="Dialogue.html#display_trunk-class_method" title="Dialogue.display_trunk (method)">display_trunk</a></span> + <small>Dialogue</small> </div> </li> <li class="odd "> <div class="item"> - <span class='object_link'><a href="Planter/Spade.html#edit_trunk-instance_method" title="Planter::Spade#edit_trunk (method)">#edit_trunk</a></span> - <small>Planter::Spade</small> + <span class='object_link'><a href="Sapling.html#edit-instance_method" title="Sapling#edit (method)">#edit</a></span> + <small>Sapling</small> + </div> + </li> + + + <li class="even "> + <div class="item"> + <span class='object_link'><a href="Planter/Plot.html#edit_branch-instance_method" title="Planter::Plot#edit_branch (method)">#edit_branch</a></span> + <small>Planter::Plot</small> + </div> + </li> + + + <li class="odd "> + <div class="item"> + <span class='object_link'><a href="Planter/Plot.html#edit_leaf-instance_method" title="Planter::Plot#edit_leaf (method)">#edit_leaf</a></span> + <small>Planter::Plot</small> + </div> + </li> + + + <li class="even "> + <div class="item"> + <span class='object_link'><a href="Planter/Plot.html#edit_trunk-instance_method" title="Planter::Plot#edit_trunk (method)">#edit_trunk</a></span> + <small>Planter::Plot</small> + </div> + </li> + + + <li class="odd "> + <div class="item"> + <span class='object_link'><a href="Sapling.html#export-instance_method" title="Sapling#export (method)">#export</a></span> + <small>Sapling</small> </div> </li> @@ -110,8 +142,24 @@ <li class="odd "> <div class="item"> - <span class='object_link'><a href="Gardner.html#grow-class_method" title="Gardner.grow (method)">grow</a></span> - <small>Gardner</small> + <span class='object_link'><a href="Planter/Spade.html#get_response-instance_method" title="Planter::Spade#get_response (method)">#get_response</a></span> + <small>Planter::Spade</small> + </div> + </li> + + + <li class="even "> + <div class="item"> + <span class='object_link'><a href="Dialogue/Speaker.html#get_response-instance_method" title="Dialogue::Speaker#get_response (method)">#get_response</a></span> + <small>Dialogue::Speaker</small> + </div> + </li> + + + <li class="odd "> + <div class="item"> + <span class='object_link'><a href="Planter/Spade.html#initialize-instance_method" title="Planter::Spade#initialize (method)">#initialize</a></span> + <small>Planter::Spade</small> </div> </li> @@ -126,7 +174,7 @@ <li class="odd "> <div class="item"> - <span class='object_link'><a href="Planter/Spade.html#plant-instance_method" title="Planter::Spade#plant (method)">#plant</a></span> + <span class='object_link'><a href="Planter/Spade.html#parse_response-instance_method" title="Planter::Spade#parse_response (method)">#parse_response</a></span> <small>Planter::Spade</small> </div> </li> @@ -134,15 +182,15 @@ <li class="even "> <div class="item"> - <span class='object_link'><a href="Gardner.html#prune_branches-class_method" title="Gardner.prune_branches (method)">prune_branches</a></span> - <small>Gardner</small> + <span class='object_link'><a href="Planter/Spade.html#plant-instance_method" title="Planter::Spade#plant (method)">#plant</a></span> + <small>Planter::Spade</small> </div> </li> <li class="odd "> <div class="item"> - <span class='object_link'><a href="Gardner.html#prune_leaves-class_method" title="Gardner.prune_leaves (method)">prune_leaves</a></span> + <span class='object_link'><a href="Gardner.html#prune_branches-class_method" title="Gardner.prune_branches (method)">prune_branches</a></span> <small>Gardner</small> </div> </li> @@ -150,7 +198,7 @@ <li class="even "> <div class="item"> - <span class='object_link'><a href="Gardner.html#prune_trunk-class_method" title="Gardner.prune_trunk (method)">prune_trunk</a></span> + <span class='object_link'><a href="Gardner.html#prune_leaves-class_method" title="Gardner.prune_leaves (method)">prune_leaves</a></span> <small>Gardner</small> </div> </li> @@ -158,8 +206,24 @@ <li class="odd "> <div class="item"> - <span class='object_link'><a href="Sapling/CLI.html#talk-instance_method" title="Sapling::CLI#talk (method)">#talk</a></span> - <small>Sapling::CLI</small> + <span class='object_link'><a href="Gardner.html#prune_trunk-class_method" title="Gardner.prune_trunk (method)">prune_trunk</a></span> + <small>Gardner</small> + </div> + </li> + + + <li class="even "> + <div class="item"> + <span class='object_link'><a href="Sapling.html#read-instance_method" title="Sapling#read (method)">#read</a></span> + <small>Sapling</small> + </div> + </li> + + + <li class="odd "> + <div class="item"> + <span class='object_link'><a href="Sapling.html#serve-instance_method" title="Sapling#serve (method)">#serve</a></span> + <small>Sapling</small> </div> </li> diff --git a/doc/top-level-namespace.html b/doc/top-level-namespace.html index 3eae178..f6508e7 100644 --- a/doc/top-level-namespace.html +++ b/doc/top-level-namespace.html @@ -82,10 +82,12 @@ <p class="children"> - <strong class="modules">Modules:</strong> <span class='object_link'><a href="Dialogue.html" title="Dialogue (module)">Dialogue</a></span>, <span class='object_link'><a href="Gardner.html" title="Gardner (module)">Gardner</a></span>, <span class='object_link'><a href="Planter.html" title="Planter (module)">Planter</a></span>, <span class='object_link'><a href="Sapling.html" title="Sapling (module)">Sapling</a></span> + <strong class="modules">Modules:</strong> <span class='object_link'><a href="Dialogue.html" title="Dialogue (module)">Dialogue</a></span>, <span class='object_link'><a href="Gardner.html" title="Gardner (module)">Gardner</a></span>, <span class='object_link'><a href="Planter.html" title="Planter (module)">Planter</a></span> + <strong class="classes">Classes:</strong> <span class='object_link'><a href="Sapling.html" title="Sapling (class)">Sapling</a></span> + </p> @@ -301,8 +303,7 @@ can point to branch 0 to immediately exit.</span><span class='tstring_end'>" 55 56 57 -58 -59</pre> +58</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/sapling/utility.rb', line 43</span> @@ -322,7 +323,6 @@ can point to branch 0 to immediately exit.</span><span class='tstring_end'>" <span class='kw'>end</span> <span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='kw'>false</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='kw'>false</span> <span class='op'>:</span> <span class='kw'>true</span> - <span class='kw'>end</span></pre> </td> </tr> @@ -334,9 +334,9 @@ can point to branch 0 to immediately exit.</span><span class='tstring_end'>" </div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div>
    -
    # File 'lib/sapling/planter.rb', line 58
    +      
    # File 'lib/sapling/planter.rb', line 127
     
    -def edit_trunk
    +def parse_response(response, branch_no)
    +  10.times { print "*" }
    +  print "\n(Your choice: "
     
    +  if response.to_i >= 1
    +    print "Change to branch #{response.to_i})\n\n"
    +    return response.to_i
    +
    +  end
    +
    +  case response.to_s.downcase
    +  when "t"
    +    print "Edit the trunk.)\n\n"
    +    @plot.edit_trunk
    +    return branch_no
    +  when "a"
    +    print "Add a new branch.)\n\n"
    +    return branch_no
    +  when "b"
    +    print "Edit the current branch.)\n\n"
    +    @plot.edit_branch(branch_no)
    +    return branch_no
    +  when "x"
    +    print "Delete the current branch.)\n\n"
    +    return branch_no
    +  when "l"
    +    print "Edit leaves of current branch.)\n\n"
    +    return branch_no
    +  when "s"
    +    print "Save changes.)\n\n"
    +    return branch_no
    +  when "q"
    +    print "Quit without saving.)\n\n"
    +    print "Unsaved changes will be lost. Still quit? [y/n]> "
    +    verify = STDIN.gets.chomp.to_s.downcase
    +
    +    return 0 if verify == "y" 
    +    return branch_no
    +  else
    +    print "Unknown option. Returning to current branch.)\n\n"
    +    return branch_no
    +  end
     end
    -
    # File 'lib/sapling/planter.rb', line 22
    +      
    # File 'lib/sapling/planter.rb', line 67
     
     def plant
       @plot = Plot.new
       @plot.tree = @file
    -  @plot.trunk = @file.shift.values[0]
    +  @plot.trunk = @file.shift
       @plot.branches = Gardner.prune_branches(@file)
     
    -  dig(1)
    +  next_branch = dig(1)
    +  until next_branch == 0 do
    +    next_branch = dig(next_branch)
    +  end
    +
    +  puts "\n#{@plot.branches[0]["desc"]}"
    +  exit
     end