diff --git a/docs/array.html b/docs/array.html index 5f3499d..6f81297 100755 --- a/docs/array.html +++ b/docs/array.html @@ -30,15 +30,15 @@ - +
  • - BaseObject + Boolean
  • - +
  • - Boolean + Channel
  • @@ -66,6 +66,12 @@ + +
  • + Http +
  • +
    +
  • Integer @@ -90,12 +96,36 @@
  • + +
  • + Plugin +
  • +
    + + +
  • + Range +
  • +
    +
  • String
  • + +
  • + Struct +
  • +
    + + +
  • + Uri +
  • +
    + @@ -137,7 +167,10 @@

     a = [1, 2, 3, "a", "b", "c"]
      a[0]  # => 1
      a[3]  # => "a"
    - a[10] # => null
    + a[10] # => nil
    + a[-1] # => "c"
    + a[-3] # => "a"
    + a[-7] # => nil
     
    @@ -147,7 +180,7 @@

    - ( + ( source )

    @@ -170,7 +203,8 @@

     a = []
      a[0] = 10  # => 10
      a[3] = 20  # => 20
    - a          # => [10, null, null, 20]
    + a          # => [10, nil, nil, 20]
    + a[-2] = 5  # => [10, nil, 5, 20]
     
    @@ -180,15 +214,15 @@

    - ( + ( source )

    - # -

    - length + # +

    + at @@ -196,9 +230,14 @@

    -

    Returns the length of the array.

    +

    Retrieves an object in an array using the index argument. + It raises an error if index out of range.

    -
     [1, 2, 3].length # => 3
    +
     a = [1, 2, 3]
    + a.at(0)  # => 1
    + a.at(10) # => nil
    + a.at(-2) # => 2
    + a.at(-4) # => nil
     
    @@ -208,15 +247,15 @@

    - ( + ( source )

    - # -

    - pop + # +

    + clear @@ -224,11 +263,11 @@

    -

    Removes the last element in the array and returns it.

    +

    Removes all elements in the array and returns an empty array.

     a = [1, 2, 3]
    - a.pop # => 3
    - a     # => [1, 2]
    + a.clear # => []
    + a       # => []
     
    @@ -238,15 +277,15 @@

    - ( + ( source )

    - # -

    - push + # +

    + concat @@ -254,10 +293,11 @@

    -

    Appends the given object to the array and returns the array.

    +

    Appends any number of argument to the array.

     a = [1, 2, 3]
    - a.push(4) # => [1, 2, 3, 4]
    + a.concat(4, 5, 6)
    + a # => [1, 2, 3, 4, 5, 6]
     
    @@ -267,15 +307,15 @@

    - ( + ( source )

    - # -

    - shift + # +

    + count @@ -283,11 +323,15 @@

    -

    Removes the first element in the array and returns it.

    +

    Loop through each element with the given block. + Return the sum of elements that return true from yield.

    -
     a = [1, 2, 3]
    - a.shift # => 1
    - a       # => [2, 3]
    +
     a = [1, 2, 3, 4, 5]
    +
    + a.count do |e|
    +   e * 2 > 3
    + end
    + # => 4
     
    @@ -297,7 +341,7 @@

    - ( + ( source )

    @@ -332,7 +376,7 @@

    - ( + ( source )

    @@ -356,15 +400,15 @@

    - ( + ( source )

    - # -

    - map + # +

    + first @@ -372,15 +416,7 @@

    -

    Loop through each element with the given block. Return a new array with each yield element.

    - -
     a = ["a", "b", "c"]
    -
    - a.map do |e|
    -   e + e
    - end
    - # => ["aa", "bb", "cc"]
    -
    +

    Returns the first element of the array.

    @@ -389,15 +425,15 @@

    - ( + ( source )

    - # -

    - select + # +

    + last @@ -405,16 +441,7 @@

    -

    Loop through each element with the given block. - Return a new array with each element that returns true from yield.

    - -
     a = [1, 2, 3, 4, 5]
    -
    - a.select do |e|
    -   e + 1 > 3
    - end
    - # => [3, 4, 5]
    -
    +

    Returns the last element of the array.

    @@ -423,46 +450,62 @@

    - ( + ( source )

    - # -

    - at + # +

    + length + => + + + + Integer + + +

    -

    Retrieves an object in an array using the index argument. - It raises an error if index out of range.

    +

    Returns the length of the array.

    -
     a = [1, 2, 3]
    - a.at(0)  # => 1
    - a.at(10) # => Error
    +
     [1, 2, 3].length # => 3
     
    + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    - # -

    - clear + # +

    + map @@ -470,11 +513,14 @@

    -

    Removes all elements in the array and returns an empty array.

    +

    Loop through each element with the given block. Return a new array with each yield element.

    -
     a = [1, 2, 3]
    - a.clear # => []
    - a       # => []
    +
     a = ["a", "b", "c"]
    +
    + a.map do |e|
    +   e + e
    + end
    + # => ["aa", "bb", "cc"]
     
    @@ -484,15 +530,15 @@

    - ( + ( source )

    - # -

    - concat + # +

    + pop @@ -500,11 +546,11 @@

    -

    Appends any number of argument to the array.

    +

    Removes the last element in the array and returns it.

     a = [1, 2, 3]
    - a.concat(4, 5, 6)
    - a # => [1, 2, 3, 4, 5, 6]
    + a.pop # => 3
    + a     # => [1, 2]
     
    @@ -514,15 +560,15 @@

    - ( + ( source )

    - # -

    - count + # +

    + push @@ -530,15 +576,10 @@

    -

    Loop through each element with the given block. - Return the sum of elements that return true from yield.

    - -
     a = [1, 2, 3, 4, 5]
    +          

    Appends the given object to the array and returns the array.

    - a.count do |e| - e * 2 > 3 - end - # => 4 +
     a = [1, 2, 3]
    + a.push(4) # => [1, 2, 3, 4]
     
    @@ -548,7 +589,7 @@

    - ( + ( source )

    @@ -581,15 +622,15 @@

    - ( + ( source )

    - # -

    - first + # +

    + select @@ -597,7 +638,16 @@

    -

    Returns the first element of the array.

    +

    Loop through each element with the given block. + Return a new array with each element that returns true from yield.

    + +
     a = [1, 2, 3, 4, 5]
    +
    + a.select do |e|
    +   e + 1 > 3
    + end
    + # => [3, 4, 5]
    +
    @@ -606,15 +656,15 @@

    - ( + ( source )

    - # -

    - last + # +

    + shift @@ -622,7 +672,12 @@

    -

    Returns the last element of the array.

    +

    Removes the first element in the array and returns it.

    + +
     a = [1, 2, 3]
    + a.shift # => 1
    + a       # => [2, 3]
    +
    @@ -631,7 +686,7 @@

    - ( + ( source )

    diff --git a/docs/boolean.html b/docs/boolean.html index dad89d8..22fcf9a 100755 --- a/docs/boolean.html +++ b/docs/boolean.html @@ -30,15 +30,15 @@ - +
  • - BaseObject + Boolean
  • - +
  • - Boolean + Channel
  • @@ -66,6 +66,12 @@ + +
  • + Http +
  • +
    +
  • Integer @@ -90,12 +96,36 @@
  • + +
  • + Plugin +
  • +
    + + +
  • + Range +
  • +
    +
  • String
  • + +
  • + Struct +
  • +
    + + +
  • + Uri +
  • +
    + @@ -106,7 +136,8 @@

    Boolean

    Description


    BooleanObject represents boolean object in goby. - It includes true and FALSE which represents logically true and false value.

    + It includes true and FALSE which represents logically true and false value. + - Boolean.new is not supported.

    Class Methods

    @@ -125,21 +156,44 @@

    == + => + + + + Boolean + + +

    Returns true if the receiver equals to the argument.

    +
     1 == 1 # => true
    + 100 == 33 # => false
    +
    +
    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -150,21 +204,44 @@

    != + => + + + + Boolean + + +

    Returns true if the receiver is not equals to the argument.

    +
     4 != 2 # => true
    + 45 != 45 # => false
    +
    +
    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -175,7 +252,15 @@

    ! + => + + + + Boolean + + +

    @@ -190,10 +275,21 @@

    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -204,7 +300,15 @@

    && + => + + + + Boolean + + +

    @@ -219,10 +323,21 @@

    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -233,7 +348,15 @@

    || + => + + + + Boolean + + +

    @@ -249,10 +372,21 @@

    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    diff --git a/docs/channel.html b/docs/channel.html new file mode 100755 index 0000000..137da99 --- /dev/null +++ b/docs/channel.html @@ -0,0 +1,251 @@ + + + + + + + + + + + + + + + + + Goby API Documentation + + + +
    + + + + +
    +

    Channel

    + +

    Description

    +
    +

    ChannelObject represents a goby channel, which carries a golang channel

    +
    + +

    Class Methods

    +
    + +

    + # +

    + new + + + +

    +

    +
    +
    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    + + + + + +

    Instance Methods

    +
    + +

    + # +

    + close + + + +

    +

    +
    +
    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + deliver + + + +

    +

    +
    +
    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + receive + + + +

    +

    +
    +
    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    + +
    + +
    + + diff --git a/docs/class.html b/docs/class.html index f7e81e4..142cc60 100755 --- a/docs/class.html +++ b/docs/class.html @@ -30,15 +30,15 @@ - +
  • - BaseObject + Boolean
  • - +
  • - Boolean + Channel
  • @@ -66,6 +66,12 @@ + +
  • + Http +
  • +
    +
  • Integer @@ -90,12 +96,36 @@
  • + +
  • + Plugin +
  • +
    + + +
  • + Range +
  • +
    +
  • String
  • + +
  • + Struct +
  • +
    + + +
  • + Uri +
  • +
    + @@ -105,38 +135,190 @@

    Class

    Description


    -

    Class is an interface that implements a class’s basic functions.

    - -
      -
    • lookupClassMethod: search for current class’s class method with given name.
    • -
    • lookupInstanceMethod: search for current class’s instance method with given name.
    • -
    • ReturnName returns class’s name
    • -
    -
    +

    Class Methods


    +

    + # +

    + attr_accessor + + ( + + + *args + + + ) + + + => + + + + + Null + + + +

    +

    +
    +
    +

    Creates instance variables and corresponding methods that return the value of + each instance variable and assign an argument to each instance variable. + Only string literal can be used for now.

    + +
     class Foo
    +   attr_accessor("bar", "buz")
    + end
    +
    + +

    is equivalent to:

    + +
     class Foo
    +   def bar
    +     @bar
    +   end
    +   def buz
    +     @buz
    +   end
    +   def bar=(val)
    +     @bar = val
    +   end
    +   def buz=(val)
    +     @buz = val
    +   end
    + end
    +
    + +
    +
    + + +
      +
    • + Parameter: *args + + + (String) + + : + + + One or more quoted method names for ‘getter/setter’ + +
    • +
    + + + + +
      +
    • + Return: (Null) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    +

    #

    attr_reader + ( + + + *args + + + ) + + => + + + + Null + + +

    - +

    Creates instance variables and corresponding methods that return the value of each + instance variable.

    + +

    Only string literal can be used for now.

    + +
     class Foo
    +   attr_reader("bar", "buz")
    + end
    +
    + +

    is equivalent to:

    + +
     class Foo
    +   def bar
    +     @bar
    +   end
    +   def buz
    +     @buz
    +   end
    + end
    +
    +
    + +
      +
    • + Parameter: *args + + + (String) + + : + + + One or more quoted method names for ‘getter’ + +
    • +
    + + + +
      +
    • + Return: (Null) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -146,69 +328,276 @@

    attr_writer + ( + + + *args + + + ) + + => + + + + Null + + +

    - +

    Creates instance variables and corresponding methods that assign an argument to each + instance variable. No return value.

    + +

    Only string literal can be used for now.

    + +
     class Foo
    +   attr_writer("bar", "buz")
    + end
    +
    + +

    is equivalent to:

    + +
     class Foo
    +   def bar=(val)
    +     @bar = val
    +   end
    +   def buz=(val)
    +     @buz = val
    +   end
    + end
    +
    +
    + +
      +
    • + Parameter: *args + + + (String) + + : + + + One or more quoted method names for ‘setter’ + +
    • +
    + + + +
      +
    • + Return: (Null) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    - # -

    - attr_accessor + # +

    + include + ( + + + module + + + ) + + => + + + + Null + + +

    - +

    Includes a module for mixin, which inherits only methods and constants from the module. + The included module is inserted into the path of the inheritance tree, between the class + and the superclass so that the methods of the module is prioritized to superclasses.

    + +

    The order of include affects: the modules that included later are prioritized. + If multiple modules include the same methods, the method will only come from + the last included module.

    + +
     module Foo
    + def ten
    +    10
    + end
    + end
    +
    + module Bar
    +   def ten
    +     "ten"
    +   end
    + end
    +
    + class Baz
    +   include(Foo)
    +   include(Bar) # method `ten` is only included from this module
    + end
    +
    + a = Baz.new
    + puts(a.ten) # => ten (overriden)
    +
    + +

    Note:

    + +

    You cannot use string literal, or pass two or more arguments to include.

    + +
       include("Foo")    # => error
    +   include(Foo, Bar) # => error
    +
    + +

    Including modules into built-in classes such as String are not supported:

    + +
     module Foo
    +   def ten
    +     10
    +   end
    + end
    + class String
    +   include(Foo) # => error
    + end
    +
    +
    + +
      +
    • + Parameter: module + + + (Class) + + : + + + Module name to include + +
    • +
    + + + +
      +
    • + Return: (Null) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    - # -

    - include + # +

    + name + ( + + + class + + + ) + + => + + + + String + + +

    - +

    Returns the name of the class (receiver).

    + +
     puts(Array.name)  # => Array
    + puts(Class.name)  # => Class
    + puts(Object.name) # => Object
    +
    +
    + +
      +
    • + Parameter: class + + + (Class) + + : + + + Receiver + +
    • +
    + + + +
      +
    • + Return: (String) : + + receiver name
    • + + +
    + +

    - ( + ( source )

    @@ -218,53 +607,308 @@

    new + ( + + + class + + + ) + + => + + + + Object + + +

    +

    Creates and returns a new anonymous class from a receiver. + You can use any classes you defined as the receiver:

    + +
     class Foo
    + end
    + a = Foo.new
    +
    + +

    Note that the built-in classes such as Class or String are not open for creating instances + and you can’t call new against them.

    + +
     a = Class.new  # => error
    + a = String.new # => error
    +
    + +
    +
    + + +
      +
    • + Parameter: class + + + (Class) + + : + + + Receiver + +
    • +
    + + + + +
      +
    • + Return: (Object) : + + object
    • + + +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + superclass + + ( + + + class + + + ) + + + => + + + + Object + + + +

    +

    +
    +
    +

    Returns the superclass object of the receiver.

    + +
     puts(Array.superclass)  # => <Class:Object>
    + puts(String.superclass) # => <Class:Object>
    +
    + class Foo;end
    + class Bar < Foo
    + end
    + puts(Foo.superclass)    # => <Class:Object>
    + puts(Bar.superclass)    # => <Class:Foo>
    +
    + +

    Note: the following is not supported:

    + +
      +
    • Class class

    • + +
    • Object class

    • + +
    • instance objects or object literals

    • +
    + +
     puts("string".superclass) # => error
    + puts(Class.superclass)    # => error
    + puts(Object.superclass)   # => error
    +
    +
    + +
      +
    • + Parameter: class + + + (Class) + + : + + + Receiver + +
    • +
    + + + +
      +
    • + Return: (Object) : + + object of the receiver
    • + + +
    + +

    - ( + ( source )

    + + + + +

    Instance Methods

    +
    +

    - # -

    - name + # +

    + == + => + + + + @boolean + + +

    +

    General method for comparing equalty of the objects

    + +
     123 == 123   # => true
    + 123 == "123" # => false
    +
    + # Hash will not concern about the key-value pair order
    + { a: 1, b: 2 } == { a: 1, b: 2 } # => true
    + { a: 1, b: 2 } == { b: 2, a: 1 } # => true
    +
    + # Hash key will be override if the key duplicated
    + { a: 1, b: 2 } == { a: 2, b: 2, a: 1 } # => true
    + { a: 1, b: 2 } == { a: 1, b: 2, a: 2 } # => false
    +
    + # Array will concern about the order of the elements
    + [1, 2, 3] == [1, 2, 3] # => true
    + [1, 2, 3] == [3, 2, 1] # => false
    +
    + +
    +
    + + + +
      +
    • + Return: (@boolean) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + != + + + => + + + + + @boolean + + +

    +

    +
    +
    +

    General method for comparing inequalty of the objects

    + +
     123 != 123   # => false
    + 123 != "123" # => true
    +
    + # Hash will not concern about the key-value pair order
    + { a: 1, b: 2 } != { a: 1, b: 2 } # => false
    + { a: 1, b: 2 } != { b: 2, a: 1 } # => false
    +
    + # Hash key will be override if the key duplicated
    + { a: 1, b: 2 } != { a: 2, b: 2, a: 1 } # => false
    + { a: 1, b: 2 } != { a: 1, b: 2, a: 2 } # => true
    +
    + # Array will concern about the order of the elements
    + [1, 2, 3] != [1, 2, 3] # => false
    + [1, 2, 3] != [3, 2, 1] # => true
    +
    +
    + +
      +
    • + Return: (@boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    - # -

    - superclass + # +

    + import @@ -280,17 +924,848 @@

    - ( + ( source )

    +

    + # +

    + require + + ( + + + filename + + + ) + + + => + + + + + Boolean + + + +

    +

    +
    +
    +

    Loads the given Goby library name without extension (mainly for modules), returning true + if successful and false if the feature is already loaded.

    +

    Currently, only the following embedded Goby libraries are targeted:

    +
      +
    • “file”
    • +
    • “net/http”
    • +
    • “net/simple_server”
    • +
    • “uri”
    • +
    +
     require("file")
    + File.extname("foo.rb")
    +
    -

    Instance Methods

    -
    +

    TBD: the load paths for require

    + +
    +
    + + +
      +
    • + Parameter: filename + + + (String) + + : + + + Quoted file name of the library, without extension + +
    • +
    + + + + +
      +
    • + Return: (Boolean) : + + of loading module
    • + + +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + require_relative + + ( + + + path/name + + + ) + + + => + + + + + Boolean + + + +

    +

    +
    +
    +

    Loads the Goby library (mainly for modules) from the given local path plus name + without extension from the current directory, returning true if successful, + and false if the feature is already loaded.

    + +
     require_relative("../test_fixtures/require_test/foo")
    + fifty = Foo.bar(5)
    +
    + +
    +
    + + +
      +
    • + Parameter: path/name + + + (String) + + : + + + Quoted file path to library plus name, without extension + +
    • +
    + + + + +
      +
    • + Return: (Boolean) : + + of loading module
    • + + +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + puts + + ( + + + *args + + + ) + + + => + + + + + Null + + + +

    +

    +
    +
    +

    Puts string literals or objects into stdout with a tailing line feed, converting into String if needed.

    + +
     puts("foo", "bar")
    + # => foo
    + # => bar
    + puts("baz", String.name)
    + # => baz
    + # => String
    + puts("foo" + "bar")
    + # => foobar
    +
    + +

    TODO: interpolation is needed to be implemented.

    + +
    +
    + + +
      +
    • + Parameter: *args + + + (Class) + + : + + + String literals, or other objects that can be converted into String . + +
    • +
    + + + + +
      +
    • + Return: (Null) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + class + + ( + + + object + + + ) + + + => + + + + + Class + + + +

    +

    +
    +
    +

    Returns the class of the object. Receiver cannot be omitted.

    + +

    FYI: You can convert the class into String with #name.

    + +
     puts(100.class)         # => <Class:Integer>
    + puts(100.class.name)    # => Integer
    + puts("123".class)       # => <Class:String>
    + puts("123".class.name)  # => String
    +
    + +
    +
    + + +
      +
    • + Parameter: object + + + (Object) + + : + + + Receiver (required) + +
    • +
    + + + + +
      +
    • + Return: (Class) : + + class of the receiver
    • + + +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + ! + + ( + + + object + + + ) + + + => + + + + + Object + + + +

    +

    +
    +
    +

    Inverts the boolean value.

    + +
     !true  # => false
    + !false # => true
    +
    + +
    +
    + + +
      +
    • + Parameter: object + + + (Object) + + : + + + object that return boolean value to invert + +
    • +
    + + + + +
      +
    • + Return: (Object) : + + boolean value
    • + + +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + sleep + + ( + + + sec + + + ) + + + => + + + + + Integer + + + +

    +

    +
    +
    +

    Suspends the current thread for duration (sec).

    + +

    Note: currently, parameter cannot be omitted, and only Integer can be specified.

    + +
     a = sleep(2)
    + puts(a)     # => 2
    +
    + +
    +
    + + +
      +
    • + Parameter: sec + + + (Integer) + + : + + + time to wait in sec + +
    • +
    + + + + +
      +
    • + Return: (Integer) : + + time slept in sec
    • + + +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + to_s + + ( + + + n/a + + + ) + + + => + + + + + String + + + +

    +

    +
    +
    +

    Returns object’s string representation.

    + +
    +
    + + +
      +
    • + Parameter: n/a + + + : + + + No Doc + +
    • +
    + + + + +
      +
    • + Return: (String) : + + string representation.
    • + + +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + block_given + + ( + + + n/a + + + ) + + + => + + + + + Boolean + + + +

    +

    +
    +
    +

    Returns true if a block is given in the current context and yield is ready to call.

    + +

    Note: The method name does not end with ‘?’ because the sign is unavalable in Goby for now.

    + +
     class File
    +   def self.open(filename, mode, perm)
    +     file = new(filename, mode, perm)
    +
    +     if block_given
    +       yield(file)
    +     end
    +
    +     file.close
    +   end
    + end
    +
    + +
    +
    + + +
      +
    • + Parameter: n/a + + + : + + + No Doc + +
    • +
    + + + + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + thread + + + +

    +

    +
    +
    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + is_a + + ( + + + n/a + + + ) + + + => + + + + + Boolean + + + +

    +

    +
    +
    +

    Returns true if Object class is equal to the input argument class

    + +
     "Hello".is_a(String)            # => true
    + 123.is_a(Integer)               # => true
    + [1, true, "String"].is_a(Array) # => true
    + { a: 1, b: 2 }.is_a(Hash)       # => true
    + "Hello".is_a(Integer)           # => false
    + 123.is_a(Range)                 # => false
    + (2..4).is_a(Hash)               # => false
    + nil.is_a(Integer)               # => false
    +
    + +
    +
    + + +
      +
    • + Parameter: n/a + + + : + + + No Doc + +
    • +
    + + + + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + is_nil + + ( + + + n/a + + + ) + + + => + + + + + Boolean + + + +

    +

    +
    +
    +

    Returns true if Object is nil

    + +
     123.is_nil            # => false
    + "String".is_nil       # => false
    + { a: 1, b: 2 }.is_nil # => false
    + (3..5).is_nil         # => false
    + nil.is_nil            # => true  (See the implementation of Null#is_nil in vm/null.go file)
    +
    + +
    +
    + + +
      +
    • + Parameter: n/a + + + : + + + No Doc + +
    • +
    + + + + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + instance_variable_get + + + +

    +

    +
    +
    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + instance_variable_set + + + +

    +

    +
    +
    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    diff --git a/docs/error.html b/docs/error.html index 2620ec5..ff4fc52 100755 --- a/docs/error.html +++ b/docs/error.html @@ -30,15 +30,15 @@ - +
  • - BaseObject + Boolean
  • - +
  • - Boolean + Channel
  • @@ -66,6 +66,12 @@ + +
  • + Http +
  • +
    +
  • Integer @@ -90,12 +96,36 @@
  • + +
  • + Plugin +
  • +
    + + +
  • + Range +
  • +
    +
  • String
  • + +
  • + Struct +
  • +
    + + +
  • + Uri +
  • +
    + @@ -105,7 +135,22 @@

    Error

    Description


    -
    +

    Error class is actually a special struct to hold internal error types with messages. + Goby developers need not to take care of the struct. + Goby maintainers should consider using the appropriate error type. + Cannot create instances of Error class, or inherit Error class.

    + +

    The type of internal errors:

    + +
      +
    • InternalError: default error type
    • +
    • ArgumentError: an argument-related error
    • +
    • NameError: a constant-related error
    • +
    • TypeError: a type-related error
    • +
    • UndefinedMethodError: undefined-method error
    • +
    • UnsupportedMethodError: intentionally unsupported-method error
    • +
    +

    Class Methods


    diff --git a/docs/file.html b/docs/file.html index fd7e328..453a1d7 100755 --- a/docs/file.html +++ b/docs/file.html @@ -30,15 +30,15 @@ - +
  • - BaseObject + Boolean
  • - +
  • - Boolean + Channel
  • @@ -66,6 +66,12 @@ + +
  • + Http +
  • +
    +
  • Integer @@ -90,12 +96,36 @@
  • + +
  • + Plugin +
  • +
    + + +
  • + Range +
  • +
    +
  • String
  • + +
  • + Struct +
  • +
    + + +
  • + Uri +
  • +
    + @@ -105,20 +135,21 @@

    File

    Description


    -
    +

    FileObject is a special type that contains file pointer so we can keep track on target file.

    +

    Class Methods


    - # -

    - extname + # +

    + basename ( - filename + filepath ) @@ -137,9 +168,9 @@

    -

    Returns extension part of a File

    +

    Returns the last element from path.

    -
     File.extname("loop.gb") # => .gb
    +
     File.basename("/home/goby/plugin/loop.gb") # => loop.gb
     
    @@ -148,7 +179,7 @@

    • - Parameter: filename + Parameter: filepath (String) @@ -177,7 +208,7 @@

    - ( + ( source )

    @@ -251,15 +282,63 @@

    - ( + ( source )

    - # -

    - size + # +

    + delete + + + +

    +

    +
    +
    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + exist + + + +

    +

    +
    +
    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + extname ( @@ -275,7 +354,7 @@

    - Integer + String @@ -283,9 +362,9 @@

    -

    Returns size of file in bytes.

    +

    Returns extension part of file.

    -
     File.size("loop.gb") # => 321123
    +
     File.extname("loop.gb") # => .gb
     
    @@ -312,7 +391,7 @@

    • - Return: (Integer) : + Return: (String) : No Doc @@ -323,20 +402,67 @@

    - ( + ( source )

    - # -

    - basename + # +

    + join + + + => + + + + + String + + + +

    +

    +
    +
    +

    Returns string with joined elements.

    + +
     File.join("home", "goby", "plugin") # => home/goby/plugin
    +
    + +
    +
    + + + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + new ( - filepath + filename ) @@ -347,7 +473,7 @@

    - String + File @@ -355,9 +481,9 @@

    -

    Returns the last element from path.

    +

    Finds the file with given filename and initializes a file object with it.

    -
     File.basename("/home/goby/plugin/loop.gb") # => loop.gb
    +
     File.new("./samples/server.gb")
     
    @@ -366,7 +492,7 @@

    • - Parameter: filepath + Parameter: filename (String) @@ -384,7 +510,7 @@

      • - Return: (String) : + Return: (File) : No Doc @@ -395,23 +521,31 @@

    - ( + ( source )

    - # -

    - join + # +

    + size + ( + + + filename + + + ) + => - String + Integer @@ -419,19 +553,36 @@

    -

    Returns string with joined elements.

    +

    Returns size of file in bytes.

    -
     File.join("home", "goby", "plugin") # => home/goby/plugin
    +
     File.size("loop.gb") # => 321123
     
    + +
      +
    • + Parameter: filename + + + (String) + + : + + + No Doc + +
    • +
    + +
    • - Return: (String) : + Return: (Integer) : No Doc @@ -442,7 +593,7 @@

    - ( + ( source )

    @@ -514,7 +665,7 @@

    - ( + ( source )

    @@ -526,6 +677,149 @@

    Instance Methods


    +

    + # +

    + close + + + +

    +

    +
    +
    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + name + + + +

    +

    +
    +
    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + read + + + +

    +

    +
    +
    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + size + + + => + + + + + Integer + + + +

    +

    +
    +
    +

    Returns size of file in bytes.

    + +
     File.new("loop.gb").size # => 321123
    +
    + +
    +
    + + + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + write + + + +

    +

    +
    +
    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    + diff --git a/docs/hash.html b/docs/hash.html index 0fb8889..1e392dd 100755 --- a/docs/hash.html +++ b/docs/hash.html @@ -30,15 +30,15 @@ - +
  • - BaseObject + Boolean
  • - +
  • - Boolean + Channel
  • @@ -66,6 +66,12 @@ + +
  • + Http +
  • +
    +
  • Integer @@ -90,12 +96,36 @@
  • + +
  • + Plugin +
  • +
    + + +
  • + Range +
  • +
    +
  • String
  • + +
  • + Struct +
  • +
    + + +
  • + Uri +
  • +
    + @@ -105,7 +135,37 @@

    Hash

    Description


    -

    HashObject represents hash instances

    +

    HashObject represents hash instances + Hash is a collection of key-value pair, which works like a dictionary. + Hash literal is represented with curly brackets { } like { key: value }. + Each key of the hash is unique and cannot be duplicate within the hash. + Adding a leading space and a trailing space within curly brackets are preferable.

    + +
      +
    • Key: an alphanumeric word that starts with alphabet, without containing space and punctuations. +Underscore _ can also be used within the key. +String literal like “mickey mouse” cannot be used as a hash key. +The internal key is actually a String and not a Symbol for now (TBD). +Thus only a String object or a string literal should be used when referencing with [ ].
    • +
    + +
     a = { balthazar1: 100 } # valid
    + b = { 2melchior: 200 }  # invalid
    + x = 'balthazar1'
    +
    + a["balthazar1"]  # => 100
    + a[x]             # => 100
    + a[balthazar1]    # => error
    +
    + + + +

    Note: + - The order of key-value pairs are not preserved. + - Operator => is not supported. + - Hash.new is not supported.

    Class Methods

    @@ -124,20 +184,48 @@

    [] + => + + + + Object + + +

    - +

    Retrieves the value (object) that corresponds to the key specified. + Returns nil when specifying a nonexistent key.

    + +
     h = { a: 1, b: "2", c: [1, 2, 3], d: { k: 'v' } }
    + h['a'] #=> 1
    + h['b'] #=> "2"
    + h['c'] #=> [1, 2, 3]
    + h['d'] #=> { k: 'v' }
    +
    +
    + +
      +
    • + Return: (Object) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -148,20 +236,435 @@

    []= + => + + + + + Object + + + +

    +

    +
    +
    +

    Associates the value given by value with the key given by key. + Returns the value.

    + +
     h = { a: 1, b: "2", c: [1, 2, 3], d: { k: 'v' } }
    + h['a'] = 1          #=> 1
    + h['b'] = "2"        #=> "2"
    + h['c'] = [1, 2, 3]  #=> [1, 2, 3]
    + h['d'] = { k: 'v' } #=> { k: 'v' }
    +
    + +
    +
    + + + +
      +
    • + Return: (Object) : + + value
    • + + +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + clear + + + => + + + + + Boolean + + + +

    +

    +
    +
    +

    Returns empty hash (no key-value pairs)

    + +
     { a: "Hello", b: "World" }.clear # => {}
    + {}.clear                         # => {}
    +
    + +
    +
    + + + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + each_key + + + => + + + + + Array + + + +

    +

    +
    +
    +

    Loop through keys of the hash with given block frame. It also returns array of + keys in alphabetical order.

    + +
     h = { a: 1, b: "2", c: [1, 2, 3], d: { k: 'v' } }
    + h.each_key do |k|
    +   puts k
    + end
    + # => a
    + # => b
    + # => c
    + # => d
    +
    + +
    +
    + + + +
      +
    • + Return: (Array) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + each_value + + + +

    +

    +
    +
    +

    Loop through values of the hash with given block frame. It also returns array of + values of the hash in the alphabetical order of its key

    + +
     h = { a: 1, b: "2", c: [1, 2, 3], d: { k: "v" } }
    + h.each_value do |v|
    +   puts v
    + end
    + # => 1
    + # => "2"
    + # => [1, 2, 3]
    + # => { k: "v" }
    +
    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + empty + + + => + + + + + Boolean + + + +

    +

    +
    +
    +

    Returns true if hash has no key-value pairs

    + +
     {}.empty       # => true
    + { a: 1 }.empty # => false
    +
    + +
    +
    + + + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + eql + + + => + + + + + Boolean + + + +

    +

    +
    +
    +

    Returns true if hash is exactly equal to another hash

    + +
     { a: "Hello", b: "World" }.eql(1) # => false
    +
    + +
    +
    + + + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + has_key + + + => + + + + Boolean + + +

    +

    Returns true if the key exist in the hash. Currently, it can only input string + type object.

    + +
     h = { a: 1, b: "2", c: [1, 2, 3], d: { k: "v" } }
    + h.has_key("a") # => true
    + h.has_key("e") # => false
    + # TODO: Support Symbol Type Key Input
    + h.has_key(:b)  # => true
    + h.has_key(:f)  # => false
    +
    + +
    +
    + + + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + has_value + + + => + + + + + Boolean + + + +

    +

    +
    +
    +

    Returns true if the value exist in the hash.

    + +
     h = { a: 1, b: "2", c: [1, 2, 3], d: { k: "v" } }
    + h.has_value(1)          # => true
    + h.has_value(2)          # => false
    + h.has_value("2")        # => true
    + h.has_value([1, 2, 3])  # => true
    + h.has_value({ k: "v" }) # => true
    +
    + +
    +
    + + + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + keys + + + => + + + + Boolean + + + +

    +

    +
    +
    +

    Returns an array of keys (in arbitrary order)

    + +
     { a: 1, b: "2", c: [3, true, "Hello"] }.keys
    + # =>  ["c", "b", "a"] or ["b", "a", "c"] ... etc
    +
    +
    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -172,20 +675,455 @@

    length + => + + + + + Integer + + + +

    +

    +
    +
    +

    Returns the number of key-value pairs of the hash.

    + +
     h = { a: 1, b: "2", c: [1, 2, 3], d: { k: 'v' } }
    + h.length  #=> 4
    +
    + +
    +
    + + + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + map_values + + + => + + + + + Boolean + + + +

    +

    +
    +
    +

    Returns a new hash with the results of running the block once for every value. + This method does not change the keys and the receiver hash values.

    + +
     h = { a: 1, b: 2, c: 3 }
    + result = h.transform_values do |v|
    +   v * 3
    + end
    + h      # => { a: 3, b: 6, c: 9 }
    + result # => { a: 3, b: 6, c: 9 }
    +
    + +
    +
    + + + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + merge + + + => + + + + + Hash + + + +

    +

    +
    +
    +

    Returns the number of key-value pairs of the hash.

    + +
     h = { a: 1, b: "2", c: [1, 2, 3] }
    + h.merge({ b: "Hello", d: "World" })
    + # => { a: 1, b: "Hello", c: [1, 2, 3], d: "World" }
    +
    + +
    +
    + + + +
      +
    • + Return: (Hash) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + sorted_keys + + + => + + + + + Boolean + + + +

    +

    +
    +
    +

    Returns an array of keys (in arbitrary order)

    + +
     { a: 1, b: "2", c: [3, true, "Hello"] }.sorted_keys
    + # =>  ["a", "b", "c"]
    + { c: 1, b: "2", a: [3, true, "Hello"] }.sorted_keys
    + # =>  ["a", "b", "c"]
    + { b: 1, c: "2", a: [3, true, "Hello"] }.sorted_keys
    + # =>  ["a", "b", "c"]
    + { b: 1, c: "2", b: [3, true, "Hello"] }.sorted_keys
    + # =>  ["b", "c"]
    +
    + +
    +
    + + + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + to_a + + + => + + + + + Array + + + +

    +

    +
    +
    +

    Returns two-dimensional array with the key-value pairs of hash. If specified true + then it will return sorted key value pairs array

    + +
     { a: 1, b: 2, c: 3 }.to_a
    + # => [["a", 1], ["c", 3], ["b", 2]] or [["b", 2], ["c", 3], ["a", 1]] ... etc
    + { a: 1, b: 2, c: 3 }.to_a(true)
    + # => [["a", 1], ["b", 2], ["c", 3]]
    + { b: 1, a: 2, c: 3 }.to_a(true)
    + # => [["a", 2], ["b", 1], ["c", 3]]
    + { b: 1, a: 2, a: 3 }.to_a(true)
    + # => [["a", 3], ["b", 1]]
    +
    + +
    +
    + + + +
      +
    • + Return: (Array) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + to_json + + + => + + + + + String + + + +

    +

    +
    +
    +

    Returns json that is corresponding to the hash. + Basically just like Hash#to_json in Rails but currently doesn’t support options.

    + +
     h = { a: 1, b: [1, "2", [4, 5, nil], { foo: "bar" }]}.to_json
    + puts(h) #=> {"a":1,"b":[1, "2", [4, 5, null], {"foo":"bar"}]}
    +
    + +
    +
    + + + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + to_s + + + => + + + + String + + +

    +

    Returns json that is corresponding to the hash. + Basically just like Hash#to_json in Rails but currently doesn’t support options.

    + +
     h = { a: 1, b: [1, "2", [4, 5, nil], { foo: "bar" }]}.to_s
    + puts(h) #=> "{ a: 1, b: [1, \"2\", [4, 5, null], { foo: \"bar \" }] }"
    +
    + +
    +
    + + + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + transform_values + + + => + + + + + Boolean + + + +

    +

    +
    +

    Returns a new hash with the results of running the block once for every value. + This method does not change the keys and unlike Hash#map_values, it does not + change the receiver hash values.

    + +
     h = { a: 1, b: 2, c: 3 }
    + result = h.transform_values do |v|
    +   v * 3
    + end
    + h      # => { a: 1, b: 2, c: 3 }
    + result # => { a: 3, b: 6, c: 9 }
    +
    + +
    +
    + + + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + values + + => + + + + Boolean + + + +

    +

    +
    +
    +

    Returns an array of values (in arbitrary order)

    + +
     { a: 1, b: "2", c: [3, true, "Hello"] }.keys
    + # =>  [1, "2", [3, true, "Hello"]] or ["2", [3, true, "Hello"], 1] ... etc
    +
    + +
    +
    + + + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    diff --git a/docs/http.html b/docs/http.html new file mode 100755 index 0000000..ef16254 --- /dev/null +++ b/docs/http.html @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + Goby API Documentation + + + +
    + + + + +
    +

    Http

    + +

    Description

    +
    +
    + +

    Class Methods

    +
    + +

    + # +

    + get + + + +

    +

    +
    +
    +

    Sends a GET request to the target and returns the HTTP response as a string.

    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    + + + + + +

    Instance Methods

    +
    + +
    + +
    + + diff --git a/docs/index.html b/docs/index.html index 52f5637..ec9fcaa 100755 --- a/docs/index.html +++ b/docs/index.html @@ -30,15 +30,15 @@ - +
  • - BaseObject + Boolean
  • - +
  • - Boolean + Channel
  • @@ -66,6 +66,12 @@ + +
  • + Http +
  • +
    +
  • Integer @@ -90,12 +96,36 @@
  • + +
  • + Plugin +
  • +
    + + +
  • + Range +
  • +
    +
  • String
  • + +
  • + Struct +
  • +
    + + +
  • + Uri +
  • +
    +
    diff --git a/docs/integer.html b/docs/integer.html index 1dde45b..85b0d5d 100755 --- a/docs/integer.html +++ b/docs/integer.html @@ -30,15 +30,15 @@ - +
  • - BaseObject + Boolean
  • - +
  • - Boolean + Channel
  • @@ -66,6 +66,12 @@ + +
  • + Http +
  • +
    +
  • Integer @@ -90,12 +96,36 @@
  • + +
  • + Plugin +
  • +
    + + +
  • + Range +
  • +
    +
  • String
  • + +
  • + Struct +
  • +
    + + +
  • + Uri +
  • +
    + @@ -110,6 +140,10 @@

    Description

     1 + 1 # => 2
      2 * 2 # => 4
     
    + +
      +
    • Integer.new is not supported.
    • +

    Class Methods

    @@ -127,35 +161,33 @@

    + - ( + + => + + + - - other - + Integer - ) + - -

    Returns the sum of self and another Integer

    +
     1 + 2 # => 3
    +
    +
    +
    • - Parameter: other - - - (Integer) - - : - + Return: (Integer) : No Doc @@ -163,11 +195,57 @@

    +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + % + + + => + + + + Integer + + + +

    +

    +
    +
    +

    Divides left hand operand by right hand operand and returns remainder.

    + +
     5 % 2 # => 1
    +
    + +
    +
    + + + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -178,21 +256,43 @@

    - + => + + + + Integer + + +

    Returns the subtraction of another Integer from self.

    +
     1 - 1 # => 0
    +
    +
    + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -203,21 +303,43 @@

    * + => + + + + Integer + + +

    Returns self multiplying another Integer

    +
     2 * 10 # => 20
    +
    +
    + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -228,21 +350,43 @@

    ** + => + + + + Integer + + +

    Returns self squaring another Integer

    +
     2 ** 8 # => 256
    +
    +
    + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -253,21 +397,43 @@

    / + => + + + + Integer + + +

    Returns self divided by another Integer

    +
     6 / 3 # => 2
    +
    +
    + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -278,21 +444,44 @@

    > + => + + + + Boolean + + +

    Returns if self is larger than another Integer

    +
     10 > -1 # => true
    + 3 > 3 # => false
    +
    +
    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -303,21 +492,44 @@

    >= + => + + + + Boolean + + +

    Returns if self is larger than or equals to another Integer

    +
     2 >= 1 # => true
    + 1 >= 1 # => true
    +
    +
    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -328,21 +540,44 @@

    < + => + + + + Boolean + + +

    Returns if self is smaller than another Integer

    +
     1 < 3 # => true
    + 1 < 1 # => false
    +
    +
    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -353,21 +588,44 @@

    <= + => + + + + Boolean + + +

    Returns if self is smaller than or equals to another Integer

    +
     1 <= 3 # => true
    + 1 <= 1 # => true
    +
    +
    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -378,21 +636,45 @@

    <=> + => + + + + Integer + + +

    Returns 1 if self is larger than the incoming Integer -1 if smaller. Otherwise 0.

    +
     1 <=> 3 # => -1
    + 1 <=> 1 # => 0
    + 3 <=> 1 # => 1
    +
    +
    + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -403,21 +685,44 @@

    == + => + + + + Boolean + + +

    Returns if self is equal to another Integer

    +
     1 == 3 # => false
    + 1 == 1 # => true
    +
    +
    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -428,21 +733,44 @@

    != + => + + + + Boolean + + +

    Returns if self is not equal to another Integer

    +
     1 != 3 # => true
    + 1 != 1 # => false
    +
    +
    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -453,21 +781,43 @@

    ++ + => + + + + Integer + + +

    Adds 1 to self and returns.

    +
     1++ # => 2
    +
    +
    + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -478,46 +828,91 @@

    -- + => + + + + Integer + + +

    Substracts 1 from self and returns.

    +
     0-- # => -1
    +
    +
    + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    - # -

    - to_s + # +

    + even + => + + + + Boolean + + +

    -

    Returns a String representation of self.

    +

    Returns if self is even.

    + +
     1.even # => false
    + 2.even # => true
    +
    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -528,100 +923,185 @@

    to_i + => + + + + Integer + + +

    Returns self.

    +
     100.to_i # => 100
    +
    +
    + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    - # -

    - even + # +

    + to_s + => + + + + String + + +

    -

    Returns if self is even.

    +

    Returns a String representation of self.

    + +
     100.to_s # => "100"
    +
    + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    - # -

    - odd + # +

    + next + => + + + + Integer + + +

    -

    Returns if self is odd.

    +

    Returns self + 1.

    -
     3.odd # => true
    - 4.odd # => false
    +
     100.next # => 101
     
    + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    - # -

    - next + # +

    + odd + => + + + + Boolean + + +

    -

    Returns self + 1.

    +

    Returns if self is odd.

    + +
     3.odd # => true
    + 4.odd # => false
    +
    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -632,21 +1112,43 @@

    pred + => + + + + Integer + + +

    Returns self - 1.

    +
     40.pred # => 39
    +
    +
    + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -664,6 +1166,61 @@

    Yields a block a number of times equals to self.

    +
     a = 0
    + 3.times do
    +    a++
    + end
    + a # => 3
    +
    + +
    +
    + + +
    + +

    + ( + source + ) +

    + +

    + # +

    + to_int32 + + + +

    +

    +
    +
    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + to_int64 + + + +

    +

    +
    +
    +
    @@ -671,7 +1228,7 @@

    - ( + ( source )

    diff --git a/docs/method.html b/docs/method.html index 8bb3391..2cf7f1d 100755 --- a/docs/method.html +++ b/docs/method.html @@ -30,15 +30,15 @@ - +
  • - BaseObject + Boolean
  • - +
  • - Boolean + Channel
  • @@ -66,6 +66,12 @@ + +
  • + Http +
  • +
    +
  • Integer @@ -90,12 +96,36 @@
  • + +
  • + Plugin +
  • +
    + + +
  • + Range +
  • +
    +
  • String
  • + +
  • + Struct +
  • +
    + + +
  • + Uri +
  • +
    + @@ -105,7 +135,7 @@

    Method

    Description


    -

    Method represents methods defined using goby.

    +

    BuiltInMethodObject represents methods defined in go.

    Class Methods

    diff --git a/docs/null.html b/docs/null.html index f39af90..9ec3756 100755 --- a/docs/null.html +++ b/docs/null.html @@ -30,15 +30,15 @@ - +
  • - BaseObject + Boolean
  • - +
  • - Boolean + Channel
  • @@ -66,6 +66,12 @@ + +
  • + Http +
  • +
    +
  • Integer @@ -90,12 +96,36 @@
  • + +
  • + Plugin +
  • +
    + + +
  • + Range +
  • +
    +
  • String
  • + +
  • + Struct +
  • +
    + + +
  • + Uri +
  • +
    +
    @@ -105,7 +135,9 @@

    Null

    Description


    -

    NullObject represnts the null value in Goby.

    +

    NullObject (nil) represents the null value in Goby. + nil is convert into null when exported to JSON format. + - Null.new is not supported.

    Class Methods

    diff --git a/docs/object.html b/docs/object.html index f19886d..18c5b3a 100755 --- a/docs/object.html +++ b/docs/object.html @@ -30,15 +30,15 @@ - +
  • - BaseObject + Boolean
  • - +
  • - Boolean + Channel
  • @@ -66,6 +66,12 @@ + +
  • + Http +
  • +
    +
  • Integer @@ -90,12 +96,36 @@
  • + +
  • + Plugin +
  • +
    + + +
  • + Range +
  • +
    +
  • String
  • + +
  • + Struct +
  • +
    + + +
  • + Uri +
  • +
    +
    @@ -105,7 +135,8 @@

    Object

    Description


    -
    +

    RObject represents any non built-in class’s instance.

    +

    Class Methods


    diff --git a/docs/plugin.html b/docs/plugin.html new file mode 100755 index 0000000..6b0d7e0 --- /dev/null +++ b/docs/plugin.html @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + Goby API Documentation + + + +
    + + + + +
    +

    Plugin

    + +

    Description

    +
    +

    PluginObject is a special type that contains a Go’s plugin

    +
    + +

    Class Methods

    +
    + + + + + +

    Instance Methods

    +
    + +

    + # +

    + send + + + +

    +

    +
    +
    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    + +
    + +
    + + diff --git a/docs/base_object.html b/docs/range.html similarity index 68% rename from docs/base_object.html rename to docs/range.html index 0fceadb..e9f4f52 100755 --- a/docs/base_object.html +++ b/docs/range.html @@ -30,15 +30,15 @@ - +
  • - BaseObject + Boolean
  • - +
  • - Boolean + Channel
  • @@ -66,6 +66,12 @@ + +
  • + Http +
  • +
    +
  • Integer @@ -90,22 +96,62 @@
  • + +
  • + Plugin +
  • +
    + + +
  • + Range +
  • +
    +
  • String
  • + +
  • + Struct +
  • +
    + + +
  • + Uri +
  • +
    +
    -

    BaseObject

    +

    Range

    Description


    -

    BaseObject is an interface that implements basic functions any object requires.

    +

    RangeObject is the built in range class + Range represents an interval: a set of values from the beginning to the end specified. + Currently, only Integer objects or integer literal are supported.

    + +
     r = 0
    + (1..(1+4)).each do |i|
    +   puts(r = r + i)
    + end
    +
    + +
     r = 0
    + a = 1
    + b = 5
    + (a..b).each do |i|
    +   r = r + i
    + end
    +

    Class Methods

    diff --git a/docs/string.html b/docs/string.html index ffc57c9..b8fcf7c 100755 --- a/docs/string.html +++ b/docs/string.html @@ -30,15 +30,15 @@ - +
  • - BaseObject + Boolean
  • - +
  • - Boolean + Channel
  • @@ -66,6 +66,12 @@ + +
  • + Http +
  • +
    +
  • Integer @@ -90,12 +96,36 @@
  • + +
  • + Plugin +
  • +
    + + +
  • + Range +
  • +
    +
  • String
  • + +
  • + Struct +
  • +
    + + +
  • + Uri +
  • +
    +
    @@ -105,7 +135,25 @@

    String

    Description


    -

    StringObject represents string instances

    +

    StringObject represents string instances + String object holds and manipulates a sequence of characters. + String objects may be created using as string literals. + Double or single quotations can be used for representation.

    + +
     a = "Three"
    + b = 'zero'
    + c = 'ζΌ’'
    + d = 'TiαΊΏng Việt'
    + e = "😏️️"
    +
    + +

    Note:

    + +
      +
    • Currently, manipulations are based upon Golang’s Unicode manipulations.
    • +
    • Currently, UTF-8 encoding is assumed based upon Golang’s string manipulation, but the encoding is not actually specified(TBD).
    • +
    • String.new is not supported.
    • +

    Class Methods

    @@ -124,20 +172,43 @@

    + + => + + + + String + + +

    - +

    Returns the concatenation of self and another String

    + +
     "first" + "-second" # => "first-second"
    +
    +
    + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -148,20 +219,43 @@

    * + => + + + + String + + +

    - +

    Returns self multiplying another Integer

    + +
     "string " * 2 # => "string string string "
    +
    +
    + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -172,20 +266,43 @@

    > + => + + + + Boolean + + +

    - +

    Returns a Boolean if first string greater than second string

    + +
     "a" < "b" # => true
    +
    +
    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -196,20 +313,43 @@

    < + => + + + + Boolean + + +

    - +

    Returns a Boolean if first string less than second string

    + +
     "a" < "b" # => true
    +
    +
    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -220,20 +360,44 @@

    == + => + + + + Boolean + + +

    - +

    Returns a Boolean of compared two strings

    + +
     "first" == "second" # => false
    + "two" == "two" # => true
    +
    +
    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -244,20 +408,45 @@

    <=> + => + + + + Integer + + +

    - +

    Returns a Integer If first string is less than second string returns -1, if equal to returns 0, if greater returns 1

    + +
     "abc" <=> "abcd" # => -1
    + "abc" <=> "abc" # => 0
    + "abcd" <=> "abc" # => 1
    +
    +
    + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -268,20 +457,154 @@

    != + => + + + + + Boolean + + + +

    +

    +
    +
    +

    Returns a Boolean of compared two strings

    + +
     "first" != "second" # => true
    + "two" != "two" # => false
    +
    + +
    +
    + + + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + [] + + + => + + + + String + + +

    +

    Returns the character of the string with specified index + It will raise error if the input is not an Integer type

    + +
     "Hello"[1]        # => "e"
    + "Hello"[5]        # => nil
    + "Hello\nWorld"[5] # => "\n"
    + "Hello"[-1]       # => "o"
    + "Hello"[-6]       # => nil
    + "Hello😊"[5]      # => "😊"
    + "Hello😊"[-1]     # => "😊"
    +
    + +
    +
    + + + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + []= + + + => + + + + + String + + +

    +

    +
    +
    +

    Replace character of the string with input string + It will raise error if the index is not Integer type or the index value is out of + range of the string length

    + +

    Currently only support assign string type value + TODO: Support to assign type which have to_s method

    + +
     "Ruby"[1] = "oo" # => "Rooby"
    + "Go"[2] = "by"   # => "Goby"
    + "Hello\nWorld"[5] = " " # => "Hello World"
    + "Ruby"[-3] = "oo" # => "Rooby"
    + "Hello😊"[5] = "🐟" # => "Hello🐟"
    +
    +
    + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -292,44 +615,243 @@

    capitalize + => + + + + + String + + + +

    +

    +
    +
    +

    Return a new String with the first character converted to uppercase but the rest of string converted to lowercase.

    + +
     "test".capitalize         # => "Test"
    + "tEST".capitalize         # => "Test"
    + "heLlo\nWoRLd".capitalize # => "Hello\nworld"
    + "😊HeLlO🐟".capitalize    # => "😊hello🐟"
    +
    + +
    +
    + + + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + chop + + + => + + + + String + + +

    +

    Returns a string with the last character chopped

    + +
     "Hello".chop         # => "Hell"
    + "Hello World\n".chop # => "Hello World"
    + "Hello😊".chop       # => "Hello"
    +
    + +
    +
    + + + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + concat + + + => + + + + + String + + +

    +

    +
    +
    +

    Returns a string which is concatenate with the input string or character

    + +
     "Hello ".concat("World")   # => "Hello World"
    + "Hello World".concat("😊") # => "Hello World😊"
    +
    +
    + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    - # -

    - upcase + # +

    + count + => + + + + Integer + + +

    +

    Returns the integer that count the string chars as UTF-8

    + +
     "abcde".count          # => 5
    + "ε“ˆε›‰οΌδΈ–η•ŒοΌ".count     # => 6
    + "Hello\nWorld".count   # => 11
    + "Hello\nWorld😊".count # => 12
    +
    + +
    +
    + + + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + delete + + + => + + + + + String + + +

    +

    +
    +
    +

    Returns a string which is being partially deleted with specified values

    + +
     "Hello hello HeLlo".delete("el")        # => "Hlo hlo HeLlo"
    + "Hello 😊 Hello 😊 Hello".delete("😊") # => "Hello  Hello  Hello"
    + # TODO: Handle delete intersection of multiple strings' input case
    + "Hello hello HeLlo".delete("el", "e") # => "Hllo hllo HLlo"
    +
    +
    + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    @@ -340,140 +862,1075 @@

    downcase + => + + + + String + + +

    - +

    Returns a new String with all characters is lowercase

    + +
     "erROR".downcase        # => "error"
    + "HeLlO\tWorLD".downcase # => "hello\tworld"
    +
    +
    + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    - # -

    - size + # +

    + empty + => + + + + Boolean + + +

    - +

    Returns true if string is empty value

    + +
     "".empty      # => true
    + "Hello".empty # => false
    +
    +
    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    - # -

    - length + # +

    + end_with + => + + + + Boolean + + +

    - +

    Returns true if receiver string end with the argument string

    + +
     "Hello".end_with("llo")     # => true
    + "Hello".end_with("ell")     # => false
    + "😊Hello🐟".end_with("🐟") # => true
    + "😊Hello🐟".end_with("😊") # => false
    +
    +
    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    - # -

    - reverse + # +

    + eql + => + + + + Boolean + + +

    - +

    Returns true if receiver string is equal to argument string

    + +
     "Hello".eql("Hello")     # => true
    + "Hello".eql("World")     # => false
    + "Hello😊".eql("Hello😊") # => true
    +
    +
    + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    - # -

    - to_s + # +

    + gsub + => + + + + String + + +

    - +

    TODO: Implement String#gsub When RegexObject Implemented + Returns a copy of str with the all occurrences of pattern substituted for the second argument. + The pattern is typically a String or Regexp (Not implemented yet); if given as a String any + regular expression metacharacters it contains will be interpreted literally, e.g. ‘\d’ will + match a backslash followed by β€˜d’, instead of a digit.

    + +

    Currently only support string version of String#gsub.

    + +
     "Ruby Lang".gsub("Ru", "Go")                # => "Goby Lang"
    + "Hello 😊 Hello 😊 Hello".gsub("😊", "🐟") # => "Hello 🐟 Hello 🐟 Hello"
    +
    +
    + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    - # -

    - to_i + # +

    + include + => + + + + Bool + + +

    - +

    Checks if the specified string is included in the receiver

    + +
     "Hello\nWorld".include("\n")   # => true
    + "Hello 😊 Hello".include("😊") # => true
    +
    +
    + +
      +
    • + Return: (Bool) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + insert + + + => + + + + + String + + + +

    +

    +
    +
    +

    Insert a string input in specified index value of the receiver string

    + +

    It will raise error if index value is not an integer or index value is out + of receiver string’s range

    + +

    It will also raise error if the input string value is not type string

    + +
     "Hello".insert(0, "X") # => "XHello"
    + "Hello".insert(2, "X") # => "HeXllo"
    + "Hello".insert(5, "X") # => "HelloX"
    + "Hello".insert(-1, "X") # => "HelloX"
    + "Hello".insert(-3, "X") # => "HelXlo"
    +
    + +
    +
    + + + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + length + + + => + + + + + Integer + + + +

    +

    +
    +
    +

    Returns the character length of self + Note: the length is currently byte-based, instead of charcode-based.

    + +
     "zero".length # => 4
    + "".length     # => 0
    + "😊".length   # => 1
    +
    + +
    +
    + + + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + ljust + + + => + + + + + String + + + +

    +

    +
    +
    +

    If input integer is greater than the length of receiver string, returns a new String of + length integer with receiver string left justified and padded with default “ “; otherwise, + returns receiver string.

    + +

    It will raise error if the input string length is not integer type

    + +
     "Hello".ljust(2)           # => "Hello"
    + "Hello".ljust(7)           # => "Hello  "
    + "Hello".ljust(10, "xo")    # => "Helloxoxox"
    + "Hello".ljust(10, "😊🐟") # => "Hello😊🐟😊🐟😊"
    +
    + +
    +
    + + + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + replace + + + => + + + + + String + + + +

    +

    +
    +
    +

    Return a string replaced by the input string

    + +
     "Hello".replace("World")          # => "World"
    + "δ½ ε₯½"replace("再見")              # => "再見"
    + "Ruby\nLang".replace("Goby\nLang") # => "Goby Lang"
    + "Hello😊".replace("World🐟")      # => "World🐟"
    +
    + +
    +
    + + + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + reverse + + + => + + + + + String + + + +

    +

    +
    +
    +

    Returns a new String with reverse order of self + Note: the length is currently byte-based, instead of charcode-based.

    + +
     "reverse".reverse           # => "esrever"
    + "Hello\nWorld".reverse      # => "dlroW\nolleH"
    + "Hello 😊🐟 World".reverse # => "dlroW 🐟😊 olleH"
    +
    + +
    +
    + + + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + rjust + + + => + + + + + String + + + +

    +

    +
    +
    +

    If input integer is greater than the length of receiver string, returns a new String of + length integer with receiver string right justified and padded with default “ “; otherwise, + returns receiver string.

    + +

    It will raise error if the input string length is not integer type

    + +
     "Hello".rjust(2)          # => "Hello"
    + "Hello".rjust(7)          # => "  Hello"
    + "Hello".rjust(10, "xo")   # => "xoxoxHello"
    + "Hello".rjust(10, "😊🐟") # => "😊🐟😊🐟😊Hello"
    +
    + +
    +
    + + + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + size + + + => + + + + + Integer + + + +

    +

    +
    +
    +

    Returns the character length of self + Note: the length is currently byte-based, instead of charcode-based.

    + +
     "zero".size  # => 4
    + "".size      # => 0
    + "😊".size   # => 1
    +
    + +
    +
    + + + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + slice + + + => + + + + + String + + + +

    +

    +
    +
    +

    Returns a string sliced according to the input range

    + +
     "Hello World".slice(1..6)    # => "ello W"
    + "1234567890".slice(6..1)     # => ""
    + "1234567890".slice(11..1)    # => nil
    + "1234567890".slice(11..-1)   # => nil
    + "1234567890".slice(-10..1)   # => "12"
    + "1234567890".slice(-5..1)    # => ""
    + "1234567890".slice(-10..-1)  # => "1234567890"
    + "1234567890".slice(-10..-11) # => ""
    + "1234567890".slice(1..-1)    # => "234567890"
    + "1234567890".slice(1..-1234) # => ""
    + "1234567890".slice(-11..5)   # => nil
    + "1234567890".slice(-10..-5)  # => "123456"
    + "1234567890".slice(-5..-10)  # => ""
    + "1234567890".slice(-11..-12) # => nil
    + "1234567890".slice(-10..-12) # => ""
    + "Hello 😊🐟 World".slice(1..6)    # => "ello 😊"
    + "Hello 😊🐟 World".slice(-10..7)  # => "o 😊🐟"
    + "Hello 😊🐟 World".slice(1..-1)   # => "ello 😊🐟 World"
    + "Hello 😊🐟 World".slice(-12..-5) # => "llo 😊🐟 W"
    + "Hello World".slice(4)       # => "o"
    + "Hello\nWorld".slice(6)      # => "\n"
    + "Hello World".slice(-3)      # => "r"
    + "Hello World".slice(-11)     # => "H"
    + "Hello World".slice(-12)     # => nil
    + "Hello World".slice(11)      # => nil
    + "Hello World".slice(4)       # => "o"
    + "Hello 😊🐟 World".slice(6)      # => "😊"
    + "Hello 😊🐟 World".slice(-7)      # => "🐟"
    + "Hello 😊🐟 World".slice(-10)     # => "o"
    + "Hello 😊🐟 World".slice(-15)     # => nil
    + "Hello 😊🐟 World".slice(14)      # => nil
    +
    + +
    +
    + + + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + split + + + => + + + + + Array + + + +

    +

    +
    +
    +

    Returns an array of strings separated by the given separator

    + +
     "Hello World".split("o") # => ["Hell", " W", "rld"]
    + "Goby".split("")         # => ["G", "o", "b", "y"]
    + "Hello\nWorld\nGoby".split("o") # => ["Hello", "World", "Goby"]
    + "Hello🐟World🐟Goby".split("🐟") # => ["Hello", "World", "Goby"]
    +
    + +
    +
    + + + +
      +
    • + Return: (Array) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + start_with + + + => + + + + + Boolean + + + +

    +

    +
    +
    +

    Returns true if receiver string start with the argument string

    + +
     "Hello".start_with("Hel")     # => true
    + "Hello".start_with("hel")     # => false
    + "😊Hello🐟".start_with("😊") # => true
    + "😊Hello🐟".start_with("🐟") # => false
    +
    + +
    +
    + + + +
      +
    • + Return: (Boolean) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + strip + + + => + + + + + String + + + +

    +

    +
    +
    +

    Returns a copy of str with leading and trailing whitespace removed. + Whitespace is defined as any of the following characters: null, horizontal tab, + line feed, vertical tab, form feed, carriage return, space.

    + +
     "  Goby Lang  ".strip   # => "Goby Lang"
    + "\nGoby Lang\r\t".strip # => "Goby Lang"
    +
    + +
    +
    + + + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + to_a + + + => + + + + + String + + + +

    +

    +
    +
    +

    Returns an array of characters converted from a string

    + +
     "Goby".to_a       # => ["G", "o", "b", "y"]
    + "😊Hello🐟".to_a # => ["😊", "H", "e", "l", "l", "o", "🐟"]
    +
    + +
    +
    + + + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + to_i + + + => + + + + + Integer + + + +

    +

    +
    +
    +

    Returns the result of converting self to Integer

    + +
     "123".to_i # => 123
    + "3d print".to_i # => 3
    + "some text".to_i # => 0
    +
    + +
    +
    + + + +
      +
    • + Return: (Integer) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + to_s + + + => + + + + + String + + + +

    +

    +
    +
    +

    Returns a new String with self value

    + +
     "string".to_s # => "string"
    +
    + +
    +
    + + + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + + +
    +
    +

    + ( + source + ) +

    + +

    + # +

    + upcase + + + => + + + + + String + + + +

    +

    +
    +
    +

    Returns a new String with all characters is upcase

    + +
     "very big".upcase # => "VERY BIG"
    +
    + +
    +
    + + + +
      +
    • + Return: (String) : + + No Doc + +
    • +
    + +

    - ( + ( source )

    diff --git a/docs/struct.html b/docs/struct.html new file mode 100755 index 0000000..1326456 --- /dev/null +++ b/docs/struct.html @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + Goby API Documentation + + + +
    + + + + +
    +

    Struct

    + +

    Description

    +
    +

    StructObject …

    +
    + +

    Class Methods

    +
    + + + + + +

    Instance Methods

    +
    + +

    + # +

    + send + + + +

    +

    +
    +
    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    + +
    + +
    + + diff --git a/docs/uri.html b/docs/uri.html new file mode 100755 index 0000000..20b6232 --- /dev/null +++ b/docs/uri.html @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + Goby API Documentation + + + +
    + + + + +
    +

    Uri

    + +

    Description

    +
    +
    + +

    Class Methods

    +
    + +

    + # +

    + parse + + + +

    +

    +
    +
    +

    Returns a Net::HTTP or Net::HTTPS’s instance (depends on the url scheme).

    + +
     u = URI.parse("https://example.com")
    + u.scheme # => "https"
    + u.host # => "example.com"
    + u.port # => 80
    + u.path # => "/"
    +
    + +
    +
    + + +
    +
    +

    + ( + source + ) +

    + + + + + +

    Instance Methods

    +
    + +
    + +
    + + diff --git a/parser.go b/parser.go index abdf2fe..b04f8d0 100644 --- a/parser.go +++ b/parser.go @@ -9,6 +9,8 @@ import ( "html/template" "io/ioutil" "strings" + + "github.com/k0kubun/pp" ) func ClassesFromDir(dir string) []Class { @@ -48,26 +50,36 @@ func classFromFile(filepath string) Class { // ast.Print(fset, f.Comments) // Find class & methods - var classMethods *ast.ValueSpec - var instanceMethods *ast.ValueSpec + var classMethods *ast.FuncDecl + var instanceMethods *ast.FuncDecl // Loop through declarations for _, decl := range f.Decls { // Continue only for general declarations if genDecl, ok := decl.(*ast.GenDecl); ok { for _, spec := range genDecl.Specs { + // Assign class line number if found - if tSpec, ok := spec.(*ast.TypeSpec); ok && class.MatchName(tSpec.Name.Name) { + tSpec, ok := spec.(*ast.TypeSpec) + if ok && class.MatchName(tSpec.Name.Name) { node := tSpec.Name class.Line = fset.Position(node.NamePos).Line } - // Assign class methods if found - if vSpec, ok := spec.(*ast.ValueSpec); ok && class.MatchClassMethods(vSpec.Names[0].Name) { - classMethods = vSpec - } - // Assign instance methods if found - if vSpec, ok := spec.(*ast.ValueSpec); ok && class.MatchInstanceMethods(vSpec.Names[0].Name) { - instanceMethods = vSpec - } + } + } + + // Continue only for func declarations + if funcDecl, ok := decl.(*ast.FuncDecl); ok { + decl := funcDecl.Name.Name + // Assign instance methods if found + if class.MatchInstanceMethods(decl) { + instanceMethods = funcDecl + pp.Println("MatchInstanceMethods: ", funcDecl.Name.Name) + } + + // Assign class methods if found + if class.MatchClassMethods(decl) { + classMethods = funcDecl + pp.Println("MatchClassMethods: ", funcDecl) } } } @@ -91,20 +103,24 @@ func classFromFile(filepath string) Class { return class } -func retrieveMethodsFromNode(fset *token.FileSet, valueSpec *ast.ValueSpec, allComments AllComments) []Method { +func retrieveMethodsFromNode(fset *token.FileSet, funcSpec *ast.FuncDecl, allComments AllComments) []Method { methods := []Method{} - allExpr := valueSpec.Values[0].(*ast.CompositeLit).Elts - var attrs []ast.Expr - for _, expr := range allExpr { - attrs = expr.(*ast.CompositeLit).Elts + + allStmt := funcSpec.Body.List[0] + stmt := allStmt.(*ast.ReturnStmt).Results[0] + exprs := stmt.(*ast.CompositeLit).Elts + for _, expr := range exprs { method := Method{} - // Attributes should only contain "Name" & "Fn" for now - for _, attr := range attrs { - thisExpr := attr.(*ast.KeyValueExpr) - name := thisExpr.Key.(*ast.Ident).Name + //kvs := exprs.Key.(*ast.Ident).Name + kvs := expr.(*ast.CompositeLit).Elts + for _, kv := range kvs { + k := kv.(*ast.KeyValueExpr).Key + v := kv.(*ast.KeyValueExpr).Value + name := k.(*ast.Ident).Name + // Attributes should only contain "Name" & "Fn" for now if name == "Name" { - method.FnName = strings.Replace(thisExpr.Value.(*ast.BasicLit).Value, "\"", "", -1) - method.FnLine = fset.Position(thisExpr.Key.(*ast.Ident).NamePos).Line + method.FnName = strings.Replace(v.(*ast.BasicLit).Value, "\"", "", -1) + method.FnLine = fset.Position(k.(*ast.Ident).NamePos).Line } if name == "Fn" { methodComments := allComments.findCommentFor(method.FnLine) @@ -112,6 +128,7 @@ func retrieveMethodsFromNode(fset *token.FileSet, valueSpec *ast.ValueSpec, allC method.Returns = methodComments.Returns method.Comment = template.HTML(methodComments.Description) } + pp.Println(method) } methods = append(methods, method) } diff --git a/settings.yml b/settings.yml index c759eb0..58ec3cd 100644 --- a/settings.yml +++ b/settings.yml @@ -16,6 +16,6 @@ gobypath: "/src/github.com/goby-lang/goby" # # "https://github.com/goby-lang/goby/tree/f32c1fcbfd7e1df021948de1065d342e95ebd03d/vm/integer.go#L20" # -# The source always refers to a specific commit, so don't put in branch name like 'master' or 'development'. +# The source always refers to a specific commit, so don't put in branch kvs like 'master' or 'development'. repo: "https://github.com/goby-lang/goby" -commit: "64069b9916f61d76ee828d3983c5269e0dd037b3" +commit: "25cfac50126b3cad0a28ba1334176b9d70a2ee04"