(function() { fancy.fdoc(true, "bakkdoor/fancy", {title:"Fancy Documentation", date:"2013-07-25 08:26:04 +0200", classes:{"Console":{doc:"
Console class. Used for STDIO
.
Prints a given object on STDOUT
, followed by a newline.
Reads a line from STDIN
and returns it as a String
.
Clears the Console
.
Prints a newline to STDOUT
.
Prints a given object on STDOUT
.
Prints a given message to STDOUT
, followed by reading a line from\nSTDIN
.
Number is a mixin-class for all number values (integer & floats for\nnow).
\n\n\n\n", instance_methods:{"upto:do:":{doc:"Calls block
with each Number
between self
and num
.\nExpects num
to be greater or equal to self
.
Calls block
with each Number
between self
and num
.\nExpects num
to be smaller or equal to self
.
Returns the double value of a Number.
\n\n \n\n", arg:[], file:"lib/number.fy", lines:[126, 134]}, ":negate":{doc:"Negates a Number (-1 becomes 1 and vice versa).
\n\n \n\n", arg:[], file:"lib/number.fy", lines:[160, 168]}, "min:":{doc:"\n\n \n\n", arg:["other"], file:"lib/number.fy", lines:[202, 212]}, "upto:":{doc:"Returns an Array with Numbers starting at self
and going up to num
.\nExpects num
to be greater or equal to self
.
Calls block
every steps
steps between self
and num
with the current Number
.\nExpects num
to be greater or equal to self
.
Calls block
every steps
steps between self
and num
with the current Number
.\nExpects num
to be smaller or equal to self
.
Returns the cubed value of a Number.
\n\n \n\n", arg:[], file:"lib/number.fy", lines:[136, 144]}, ":even?":{doc:"Indicates, if a Number is even.
\n\n \n\n", arg:[], file:"lib/number.fy", lines:[170, 178]}, ":random":{doc:"Returns a random number between 0 and self
.
Returns the square of a Number.
\n\n \n\n", arg:[], file:"lib/number.fy", lines:[116, 124]}, ":odd?":{doc:"Indicates, if a Number is odd.
\n\n \n\n", arg:[], file:"lib/number.fy", lines:[180, 188]}, "downto:":{doc:"Returns an Array with Numbers starting at self
and going down to num
.\nExpects num
to be smaller or equal to self
.
Returns the absolute (positive) value of a Number.
\n\n \n\n", arg:[], file:"lib/number.fy", lines:[146, 158]}, "max:":{doc:"\n\n \n\n", arg:["other"], file:"lib/number.fy", lines:[190, 200]}}, methods:{}, ancestors:["Number", "Object", "Kernel", "BasicObject"]}, "Fixnum":{doc:"Standard class for integer values in Fancy.
\n\n\n\n", instance_methods:{}, methods:{}, ancestors:["Fixnum", "Number", "Object", "BasicObject", "ImmediateValue", "Integer", "Precision", "Numeric", "Comparable", "Object", "Kernel", "BasicObject"]}, "Float":{doc:"Standard class for floating point number values in Fancy.
\n\n\n\n", instance_methods:{}, methods:{}, ancestors:["Float", "Number", "Object", "BasicObject", "Precision", "Numeric", "Comparable", "Object", "Kernel", "BasicObject"]}, "Bignum":{doc:"Class for large integer values in Fancy.
\n\n\n\n", instance_methods:{}, methods:{}, ancestors:["Bignum", "Number", "Object", "BasicObject", "Integer", "Precision", "Numeric", "Comparable", "Object", "Kernel", "BasicObject"]}, "System":{doc:"System class. Holds system-wide relevant methods.
\n\n\n\n", instance_methods:{}, methods:{":exit":{doc:"Exit the running Fancy process.
\n\n\n\n", arg:[], file:"lib/rbx/system.fy", lines:[8, 14]}, "exit:":{doc:"Exit the running Fancy process with a given exit code.
\n\n \n\n", arg:["exitcode"], file:"lib/rbx/system.fy", lines:[16, 24]}, "do:":{doc:"Runs the given string as a system() command.
\n\n\n\n", arg:["command_str"], file:"lib/rbx/system.fy", lines:[26, 32]}, "piperead:":{doc:"Runs the given string as a popen() call and returns the output\nof the call as a string.
\n\n\n\n", arg:["command_str"], file:"lib/rbx/system.fy", lines:[34, 41]}, ":abort":{doc:"Exits the current running Fancy process (application) with an exit\ncode of 1 (indicating failure).
\n\n\n\n", arg:[], file:"lib/system.fy", lines:[2, 9]}, "abort:":{doc:"Prints message
on *stderr*
and exits with an exit code of 1 (indicating\nfailure).
Runs the given string as a popen3() call and returns a IO handle\nthat can be read from
\n\n \n\n", arg:["command_str"], file:"lib/rbx/system.fy", lines:[43, 54]}, "pipe:do:":{doc:"Runs the given string as a popen3() call, passing in a given Block
.\nThe Block
is expected to take 3 arguments for STDIN
, STDOUT
and STDERR
.
Prints message
on *stderr*
, calls block
and finally exits with an exit\ncode of 1 (indicating failure).
Base Exception class.\nAll Exception classes inherit from Exception
.
StandardError. Base class of most Exception classes.
\n\n\n\n", instance_methods:{"initialize:":{doc:"Creates a new Exception with a given message.
\n\n \n\n", arg:["msg"], file:"lib/rbx/exception.fy", lines:[23, 31]}, ":initialize":{doc:"Creates a new Exception with an empty message.
\n\n\n\n", arg:[], file:"lib/rbx/exception.fy", lines:[17, 21]}, ":raise!":{doc:"Raises (throws) an Exception to be caught somewhere up the\ncallstack.
\n\n\n\n", arg:[], file:"lib/rbx/exception.fy", lines:[33, 40]}}, methods:{"raise:":{doc:"Raises new Exception
with message
.
Example:
\n\n StandardError raise: \"Error!\"\n ArgumentError raise: \"Missing argument!\"\n # is the same as:\n StandardError new: \"Error!\\\xE2\x80\x9D . raise!\n ArgumentError new: \"Missing argument!\" . raise!\n
\n\n\n\n", arg:["message"], file:"lib/exception.fy", lines:[2, 15]}}, ancestors:["StandardError", "Exception", "Object", "Kernel", "BasicObject"]}, "IO":{doc:"Base class for IO related classes (like File
, Socket
, Console
etc.).
TCP Socket class.
\n\n\n\n", instance_methods:{"send:":{doc:"Forward to message send:flags:
\n\n\n\n", arg:["msg"], file:"lib/rbx/tcp_socket.fy", lines:[20, 23]}}, methods:{"open:port:":{doc:"Creates and opens a new TCPSocket
on server
and port
.
TCP Server
\n\n\n\n", instance_methods:{}, methods:{}, ancestors:["TCPServer", "Socket ListenAndAccept", "IO Socketable", "TCPSocket", "IPSocket", "BasicSocket", "IO", "IOMixin", "Object", "BasicObject", "Unmarshalable", "File Constants", "Enumerable", "Object", "Kernel", "BasicObject"]}, "MatchData":{doc:"MatchData instances are created when using the #=== match operator\n(e.g. by using match/case expressions).
\n\n\n\n", instance_methods:{"at:":{doc:"\n\n \n\n", arg:["idx"], file:"lib/rbx/match_data.fy", lines:[11, 18]}, ":to_a":{doc:"\n\n \n\n", arg:[], file:"lib/rbx/match_data.fy", lines:[20, 30]}}, methods:{}, ancestors:["MatchData", "Unmarshalable", "Object", "Kernel", "BasicObject"]}, "Regexp":{doc:"Regular Expression class. Used by Regexp literals in Fancy.
\n\n\n\n", instance_methods:{}, methods:{}, ancestors:["Regexp", "Object", "Kernel", "BasicObject"]}, "MethodMixin":{doc:"Mixin class with common methods included by Method
and UnboundMethod
.
Returns an Array of all the FancySpec SpecTests defined for a\nMethod.
\n\n\n\n", arg:[], file:"lib/rbx/method.fy", lines:[51, 59]}}, methods:{}, ancestors:["MethodMixin", "Object", "Kernel", "BasicObject"]}, "Method":{doc:"An instance of Method represents a method on a Class.\nEvery method in Fancy is an instance of the Method class.
\n\n\n\n", instance_methods:{":call":{doc:"Forward to message call:
\n\n\n\n", arg:[], file:"lib/rbx/method.fy", lines:[78, 81]}}, methods:{}, ancestors:["Method", "MethodMixin", "Object", "BasicObject", "Unmarshalable", "Object", "Kernel", "BasicObject"]}, "UnboundMethod":{doc:"An instance UnboundMethod represents a Method object not bound to a specific Class
or Object
.
Forward to message call:
\n\n\n\n", arg:[], file:"lib/rbx/method.fy", lines:[95, 98]}}, methods:{}, ancestors:["UnboundMethod", "MethodMixin", "Object", "BasicObject", "Object", "Kernel", "BasicObject"]}, "NameError":{doc:"NameError exception class. Used within Rubinius.
\n\n\n\n", instance_methods:{}, methods:{}, ancestors:["NameError", "StandardError", "Exception", "Object", "Kernel", "BasicObject"]}, "NoMethodError":{doc:"Exception class that gets thrown when a method wasn't found within a class.
\n\n\n\n", instance_methods:{":method_name":{doc:"Returns the name of the method that was not found as a String
.
NoMethodError
\n\n\n\n", arg:[], file:"lib/rbx/no_method_error.fy", lines:[19, 21]}}, ancestors:["NoMethodError", "NameError", "StandardError", "Exception", "Object", "Kernel", "BasicObject"]}, "Thread":{doc:"Thread class.\nDeals with parallel execution.
\n\nTODO:\n=> Still need to add more Fancy-ish wrapper methods and method\n documentation.
\n\n\n\n", instance_methods:{}, methods:{"sleep:":{doc:"Sets the Fancy process for a given amount of seconds to sleep.
\n\n\n\n", arg:["seconds"], file:"lib/rbx/thread.fy", lines:[82, 86]}}, ancestors:["Thread", "Object", "Kernel", "BasicObject"]}, "Date":{doc:"Date class. Used for timely stuff.
\n\n\n\n", instance_methods:{":!=":{doc:"\n\n \n\n", arg:["other"], file:"lib/rbx/date.fy", lines:[14, 21]}}, methods:{}, ancestors:["Date", "", "Comparable", "", "Object", "Kernel", "BasicObject"]}, "Time":{doc:"Time class. Used for even more timely stuff.
\n\n\n\n", instance_methods:{}, methods:{"duration:":{doc:"Calls block
and times the runtime duration of doing so in seconds.
Example:
\n\n Time duration: { Thread sleep: 1 } # => >= 1.0\n
\n\n \n\n", arg:["block"], file:"lib/time.fy", lines:[2, 16]}}, ancestors:["Time", "Comparable", "Object", "Kernel", "BasicObject"]}, "Rubinius Actor":{doc:"Primitive Actor class.\nActors can be sent messages asynchronously. They process incoming messages\n(which can be any object, including Tuples, Arrays, Numbers ...) in a\nfirst-come, first-serve manner.
\n\nActors are used to implement asynchronous and future message sends in Fancy\nusing the @ and @@ syntax.
\n\nExample:
\n\n a = Actor spawn: {\n loop: {\n match Actor receive {\n case 'hello -> \"Hello World\" println\n case 'quit ->\n \"OK, done!\" println\n break # Quit loop and let actor die\n }\n }\n }\n\n 10 times: {\n a ! 'hello # send 'hello to actor asynchronously\n }\n a ! 'quit\n
\n\n\n\n", instance_methods:{}, methods:{"spawn:":{doc:"Example:
\n\n Actor spawn: {\n loop: {\n Actor receive println # print all incoming messages\n }\n }\n
\n\n \n\n", arg:["block"], file:"lib/rbx/actor.fy", lines:[38, 52]}}, ancestors:["Rubinius Actor", "Object", "Kernel", "BasicObject"]}, "Object":{doc:"Root class of Fancy's class hierarchy.\nAll classes inherit from Object.
\n\n\n\n", instance_methods:{":++":{doc:"Returns the String
concatenation of self
and other
.\nCalls to_s on self
and other
and concatenates the results to a new String
.
Indicates, if two objects are not equal.
\n\n \n\n", arg:["other"], file:"lib/object.fy", lines:[51, 60]}, ":&&":{doc:"Boolean conjunction.\nIf self
and other
are both true-ish (non-nil, non-false), returns other
.\nIf other
is a Block
, calls it and returns its return value.
Tells an object to let its actor to die (quit running).
\n\n\n\n", arg:[], file:"lib/object.fy", lines:[515, 521]}, ":to_i":{doc:"\n\n \n\n", arg:[], file:"lib/object.fy", lines:[155, 161]}, "get_slot:":{doc:"Returns the value of a slot of self
.
Returns a PositiveMatcher
for self.
Dynamically defines a method on self's
metaclass (a singleton method) using a given Block
.
Opens filename
and rebinds *stdout*
to it within block
.
Example:
\n\n with_output_to: \"/tmp/hello_world.txt\" do: {\n \"hello\" println\n \"world\" println\n }\n
\n\nThis writes
\n\n hello\n world\n
\n\nto /tmp/hello_world.txt
\n\n \n\n", arg:["filename", "block"], file:"lib/object.fy", lines:[739, 760]}, "undefine_singleton_method:":{doc:"Undefines a singleton method of self
.
Same as:\ncond_block until_do: body_block
\n\n\n\n", arg:["cond_block", "body_block"], file:"lib/object.fy", lines:[269, 276]}, ":does_not":{doc:"Returns a NegativeMatcher
for self.
Returns a NegativeMatcher
for self.
Indicates, if an object is an instance of a given Class.
\n\n \n\n", arg:["class"], file:"lib/rbx/object.fy", lines:[82, 91]}, "do:while:":{doc:"\n\n \n\n", arg:["body_block", "cond_block"], file:"lib/object.fy", lines:[278, 286]}, ":<=>":{doc:"\n\n \n\n", arg:["other"], file:"lib/object.fy", lines:[625, 634]}, "kind_of?:":{doc:"Same as Object#is_a?:\nIndicates, if an object is an instance of a given Class.
\n\n\n\n", arg:["class"], file:"lib/rbx/object.fy", lines:[93, 100]}, ":ruby_methods":{doc:"\n\n \n\n", arg:[], file:"lib/object.fy", lines:[770, 776]}, "receive_message:":{doc:"Dynamically sends a given message (without parameters) to self
.
Returns the Object's actor.\nIf none exists at this moment, a new one will be created\nand starts running in the background.
\n\n\n\n", arg:[], file:"lib/object.fy", lines:[523, 531]}, ":><":{doc:"Shorthand for: MatchAny new: self with: other
Infinitely calls the block (loops).
\n\n \n\n", arg:["block"], file:"lib/object.fy", lines:[19, 27]}, "unless:do:":{doc:"Same as:\ncond if_true: { nil } else: block
\n\n\n\n", arg:["cond", "block"], file:"lib/object.fy", lines:[298, 305]}, "send_future:":{doc:"Forward to message send_future:with_params:
\n\n\n\n", arg:["message"], file:"lib/object.fy", lines:[532, 543]}, ":to_s":{doc:"\n\n \n\n", arg:[], file:"lib/rbx/object.fy", lines:[31, 37]}, "receive_message:with_params:":{doc:"Dynamically sends a given message with parameters to self
.
Same as:\ncond if_true: else_block else: block
\n\n\n\n", arg:["cond", "block", "else_block"], file:"lib/object.fy", lines:[307, 314]}, ":documentation":{doc:"Returns the Fancy
Documentation
object for an Object.
Creates a FutureSend
object (a Future / Promise) that will hold the value of sending message
to self
.
Loads and evaluates a given Fancy source file by trying to find the specified\nRelative paths are allowed (and by default expected).
\n\n \n\n", arg:["file_path"], file:"lib/rbx/object.fy", lines:[12, 19]}, "responds_to?:":{doc:"Indicates if an object responds to a given message.
\n\n \n\n", arg:["message"], file:"lib/rbx/object.fy", lines:[123, 132]}, ":print":{doc:"Same as:\nstdout print: self
\n\nPrints self
on stdout
.
Same as:\ncond if_true: { nil } else: block
\n\n\n\n", arg:["cond", "block"], file:"lib/object.fy", lines:[298, 305]}, ":<>":{doc:"Shorthand for: MatchAll new: self with: other
Extends self
with the methods in class
(by including its methods in self's
metaclass).
Calls the block
(default behaviour).
Same as:\ncond if_true: else_block else: block
\n\n\n\n", arg:["cond", "block", "else_block"], file:"lib/object.fy", lines:[307, 314]}, "lambda:":{doc:"\n\n \n\n", arg:["block"], file:"lib/rbx/object.fy", lines:[144, 151]}, "if_true:else:":{doc:"Calls the then_block
(default behaviour).
Same as:\ncond if_true: block
\n\n\n\n", arg:["cond", "block"], file:"lib/object.fy", lines:[232, 239]}, "method:":{doc:"Returns the method with a given name for self, if defined.
\n\n \n\n", arg:["method_name"], file:"lib/object.fy", lines:[319, 326]}, "send_async:":{doc:"Forward to message send_async:with_params:
\n\n\n\n", arg:["message"], file:"lib/object.fy", lines:[544, 556]}, "ignoring:do:":{doc:"Example:
\n\n ignoring: (IOError, ZeroDivisionError) do: {\n # do something\n }\n
\n\n \n\n", arg:["exception_classes", "block"], file:"lib/object.fy", lines:[798, 812]}, ":nil?":{doc:"\n\n \n\n", arg:[], file:"lib/object.fy", lines:[110, 116]}, "if:then:else:":{doc:"Same as:\ncond if_true: then_block else: else_block
\n\n\n\n", arg:["cond", "then_block", "else_block"], file:"lib/object.fy", lines:[241, 248]}, ":identity":{doc:"The identity method simply returns self.
\n\n \n\n", arg:[], file:"lib/object.fy", lines:[348, 356]}, "send_async:with_params:":{doc:"Sends message
with params
to self
asynchronously and immediately returns nil
.
Returns a PositiveMatcher
for self.
Returns value
after calling block
with it.\nUseful for returning some object after using it, e.g.:
# this will return [1,2]\n returning: [] do: |arr| {\n arr << 1\n arr << 2\n }\n
\n\n \n\n", arg:["value", "block"], file:"lib/object.fy", lines:[358, 377]}, "synchronized:":{doc:"Runs a given Block
in a synchronized fashion if called by multiple Threads.\nUses a Mutex
in the background for synchronization (created on demand for each Object
).\nCalls block
with self
.
Returns a NegativeMatcher
for self.
Does nothing (default behaviour).
\n\n \n\n", arg:["block"], file:"lib/object.fy", lines:[86, 93]}, ":if_responds?":{doc:"Returns a Proxies
RespondsToProxy
for self
that forwards any messages\nonly if self
responds to them.
Example:
\n\n # only send 'some_message: if object responds to it:\n object if_responds? some_message: some_parameter\n
\n\n \n\n", arg:[], file:"lib/object.fy", lines:[379, 392]}, "if_false:else:":{doc:"Calls else_block
(default behaviour).
Copies slots from object
to self
.
Sets the current Thread (in which self is running) for a given amount to sleep.
\n\n \n\n", arg:["seconds"], file:"lib/object.fy", lines:[692, 700]}, "rebind_method:with:within:":{doc:"If within_block
takes an argument, it is called with self
.
Example:
\n\n class MyRebindableClass {\n def foo {\n 42\n }\n }\n\n r = MyRebindableClass new\n r rebind_method: 'foo with: { 0 } within: @{ foo } # => 0\n
\n\n \n\n", arg:["method_name", "rebind_callable", "within_block"], file:"lib/object.fy", lines:[814, 835]}, "if_nil:":{doc:"Does nothing (default behaviour).
\n\n \n\n", arg:["block"], file:"lib/object.fy", lines:[86, 93]}, "if_nil:else:":{doc:"Calls else_block
(default behaviour).
This is the default implementation for backtick: which gets called when using the backtick syntax.
\n\nFor example:
\n\n `cat README`\n
\n\nGets translated to the following message send:
\n\n self backtick: \"cat README\"\n
\n\nWhich allows for custom implementations of the backtick: method, if needed.\nThis default implementation works the same way as in Ruby, Perl or Bash.\nIt returns the output of running the given string on the command line as a String
.
Copies all slots from object
to self
.
Boolean disjunction.\nIf self
is true-ish (non-nil, non-false) returns self
.\nOtherwise returns other
(if other
is a Block
, calls it first and returns its return value)
Calls #value on future
. Shortcut method.
Same as:\nstdout println: self
\n\nPrints self
on stdout
, followed by a newline.
Sets the documentation string for an Object.
\n\n \n\n", arg:["docstring"], file:"lib/object.fy", lines:[338, 346]}, ":_":{doc:"\n\n \n\n", arg:[], file:"lib/object.fy", lines:[837, 843]}, "next:":{doc:"Returns value
for current iteration and skip to the next one.
Breaks / Stops current iteration.
\n\n\n\n", arg:[], file:"lib/object.fy", lines:[457, 463]}, "yield:":{doc:"Same as Fiber##yield:
\n\n\n\n", arg:["values"], file:"lib/object.fy", lines:[431, 437]}, "break:":{doc:"Returns value
from iteratioen.
Skip to the next iteration.
\n\n\n\n", arg:[], file:"lib/object.fy", lines:[439, 445]}, "tap:":{doc:"Calls a given Block
with self
before returning self
.
Same as Fiber##yield.
\n\n\n\n", arg:[], file:"lib/object.fy", lines:[423, 429]}, "let:be:":{doc:"Forward to message let:be:in:ensuring:
\n\n\n\n", arg:["var_name", "value"], file:"lib/object.fy", lines:[701, 737]}, ":to_a":{doc:"\n\n \n\n", arg:[], file:"lib/object.fy", lines:[134, 140]}, "and:":{doc:"Boolean conjunction.\nIf self
and other
are both true-ish (non-nil, non-false), returns other
.\nIf other
is a Block
, calls it and returns its return value.
Dynamically rebinds var_name
as dynamic variable with value
as the value within block
.\nExceptions raised within ensure_block
are ignored.\nThose raised in block
will be reraised up the callstack.
Example:
\n\n File write: \"/tmp/output.txt\" with: |f| {\n let: '*stdout* be: f in: {\n \"hello, world!\" println # writes it to file not STDOUT\n }\n }\n
\n\n \n\n", arg:["var_name", "value", "block", "ensure_block"], file:"lib/object.fy", lines:[702, 737]}, ":should":{doc:"Returns a PositiveMatcher
for self.
Returns a deep clone of self using Ruby's Marshal class.
\n\n \n\n", arg:[], file:"lib/rbx/object.fy", lines:[21, 29]}, "or:":{doc:"Boolean disjunction.\nIf self
is true-ish (non-nil, non-false) returns self
.\nOtherwise returns other
(if other
is a Block
, calls it first and returns its return value)
Helper method that calls block
with self
as the receiver.\nThis allows message cascading like code, e.g.:
some_complex_object do: {\n method_1: arg1\n method_2: arg2\n method_3: arg3\n }\n\n # this is the same as:\n some_complex_object method_1: arg1\n some_complex_object method_2: arg2\n some_complex_object method_3: arg3\n
\n\nIf you pass it a block with 1 argument this method behaves exactly like Object
tap:
Example:
\n\n some_complex_object do: @{\n method_1: arg1\n method_2: arg2\n method_3: arg3\n }\n
\n\n \n\n", arg:["block"], file:"lib/object.fy", lines:[636, 670]}, "set_slot:value:":{doc:"Sets an object's slot with a given value.
\n\n \n\n", arg:["slotname", "val"], file:"lib/rbx/object.fy", lines:[39, 48]}, "xor:":{doc:"\n\n \n\n", arg:["other"], file:"lib/object.fy", lines:[216, 227]}, "while:do:":{doc:"Same as:\ncond_block while_do: body_block
\n\n\n\n", arg:["cond_block", "body_block"], file:"lib/object.fy", lines:[250, 257]}, "let:be:in:":{doc:"Forward to message let:be:in:ensuring:
\n\n\n\n", arg:["var_name", "value", "block"], file:"lib/object.fy", lines:[701, 737]}}, methods:{}, ancestors:["Object", "Kernel", "BasicObject"]}, "Class":{doc:"This class is the class of Class
objects - e.g. Object
, Array
,\nString
etc.\nAny class in the language is an instance of this class, as in Ruby\nor Smalltalk.
Creates ruby_alias methods for any unary ruby methods of a class.
\n\n\n\n", arg:[], file:"lib/rbx/class.fy", lines:[207, 219]}, "write_slot:":{doc:"Defines a slot writer method for a given slotname.
\n\n \n\n", arg:["slotname"], file:"lib/class.fy", lines:[183, 191]}, "new:":{doc:"Creates a new instance of self
calling initialize:
.
Evaluates a given String
of Fancy code or a Block
in the class context of self
.\nUseful for dynamically defining methods on a class etc.
Example:
\n\n Array class_eval: \"def foo { 'foo println }\"\n [1,2,3] foo # => prints 'foo\n
\n\n \n\n", arg:["str_or_block"], file:"lib/rbx/class.fy", lines:[221, 237]}, "read_write_slot:":{doc:"Defines slot reader & writer methods for a given slotname.
\n\n \n\n", arg:["slotname"], file:"lib/class.fy", lines:[206, 215]}, "lazy_slot:value:":{doc:"Defines a lazy getter for slotname
that yields the result of calling block
and caches it in slotname
.
Default include hook. Make sure to call this via super included: class
.
Forward to message expose_to_ruby:as:
\n\n\n\n", arg:["method_name"], file:"lib/rbx/class.fy", lines:[238, 264]}, "subclass?:":{doc:"Indicates, if a Class is a subclass of another Class.
\n\n \n\n", arg:["class_obj"], file:"lib/class.fy", lines:[251, 267]}, "define_method:with:":{doc:"Defines an instance method on a Class
with a given name and\nbody.
Defines a class method on a Class
(a singleton method) with a\ngiven name and body.
Explicitly exposes a Fancy method to Ruby. If ruby_method_name
is\npassed, use that name explicitly, otherwise uses method_name
.
Example:
\n\n class Foo {\n def === other {\n # ...\n }\n\n expose_to_ruby: '===\n\n # if you don't want to expose it as :=== in Ruby:\n expose_to_ruby: '=== as: 'some_other_name_for_ruby\n }\n
\n\n \n\n", arg:["method_name", "ruby_method_name"], file:"lib/rbx/class.fy", lines:[239, 264]}, "undefine_class_method:":{doc:"Undefines a class method on a Class
with a given name.
Example:
\n\n class MyClass {\n delegate: ('to_s, 'inspect) to_slot: 'my_slot\n def initialize: @my_slot\n }\n\n m = MyClass new: [1, 2, 3]\n m to_s # => \"123\"\n m inspect # => \"[1, 2, 3]\"\n
\n\n \n\n", arg:["methods", "slotname"], file:"lib/class.fy", lines:[280, 325]}, "undefine_method:":{doc:"Undefines an instance method on a Class with a given name.
\n\n \n\n", arg:["name"], file:"lib/rbx/class.fy", lines:[72, 80]}, "subclass:":{doc:"Creates a new Class
with self
as superclass and the given body.
Forward to message rebind_instance_method:with:within:receiver:
\n\n\n\n", arg:["method_name", "rebind_callable", "within_block"], file:"lib/class.fy", lines:[535, 567]}, ":nested_classes":{doc:"Returns all the nested classes within a Class
as an Array
.
Initializes a Class
with a superclass.
Sets documentation strings for methods defined in documentation_hash
.\nUseful for documenting methods without touching their implementation.
Example:
\n\n class SomeRubyLibraryClass {\n method_documentation: <[\n 'some_method_a => \"Docstring A\",\n 'some_method_b => \"Docstring B\"\n ]>\n }\n
\n\n \n\n", arg:["documentation_hash"], file:"lib/class.fy", lines:[569, 588]}, ":fancy_instance_methods":{doc:"\n\n \n\n", arg:[], file:"lib/class.fy", lines:[343, 349]}, ":ruby_instance_methods":{doc:"\n\n \n\n", arg:[], file:"lib/class.fy", lines:[351, 357]}, "provides_interface:":{doc:"Example:
\n\n class MyCollection {\n # you can skip this if you actually define each: before you include Fancy Enumerable.\n provides_interface: ['each]\n includes: Fancy Enumerable\n }\n
\n\n \n\n", arg:["methods"], file:"lib/contracts.fy", lines:[38, 51]}, "expects_interface_on_inclusion:":{doc:"Declares a required interface (collection of method signatures) an including class has to provide.
\n\nExample:
\n\n class Enumerable {\n expects_interface_on_inclusion: ['each:]\n }\n
\n\n \n\n", arg:["methods"], file:"lib/contracts.fy", lines:[21, 34]}, "expects_interface:":{doc:"Declares a required interface (collection of method signatures) an including class has to provide.
\n\nExample:
\n\n class Enumerable {\n expects_interface_on_inclusion: ['each:]\n }\n
\n\n \n\n", arg:["methods"], file:"lib/contracts.fy", lines:[21, 34]}, "alias_method_rbx:for:":{doc:"Rbx specific version of alias_method:for: due to bootstrap order\nreasons. Should not be used directly.
\n\n\n\n", arg:["new_method_name", "old_method_name"], file:"lib/rbx/class.fy", lines:[140, 147]}, "before_method:run:":{doc:"Runs / Calls block_or_method
everytime before running method_name
.
Example:
\n\n Array before_method: 'inspect run: 'compact!\n [1, nil, 2, nil, 3] inspect # => \"[1, 2, 3]\"\n\n # Or pass a Block:\n Array before_method: 'inspect run: @{ compact! }\n
\n\n \n\n", arg:["method_name", "block_or_method_name"], file:"lib/class.fy", lines:[369, 385]}, "provides_interface?:":{doc:"\n\n \n\n", arg:["methods"], file:"lib/contracts.fy", lines:[53, 61]}, ":inspect":{doc:"Example:
\n\n Fixnum inspect # => \"Fixnum : Integer\"\n Object inspect # => \"Object\"\n
\n\n \n\n", arg:[], file:"lib/class.fy", lines:[327, 341]}, "define_calling_chain:for_method:":{doc:"Example:
\n\n class Foo {\n def foo { 'foo println }\n def bar { 'bar println }\n def baz { 'baz println }\n\n define_calling_chain: ['foo, 'bar, 'baz] for_method: 'foo\n }\n\n Foo new foo\n # prints:\n # foo\n # bar\n # baz\n\n # You can also pass in Blocks:\n Foo define_calling_chain: [@{ foo }, @{ bar }, @{ baz }] for_method: 'bar\n\n Foo new bar\n # prints:\n # foo\n # bar\n # baz\n
\n\n \n\n", arg:["blocks_or_method_names", "method_name"], file:"lib/class.fy", lines:[442, 511]}, "rebind_instance_method:with:within:receiver:":{doc:"Rebinds method_name
to rebind_callable
within within_block
.\nIf within_block
takes an argument, it will be called with receiver
(defaults to self
).
Creates a method alias for a Ruby method.
\n\n\n\n", arg:["new_method_name", "ruby_method_name"], file:"lib/rbx/class.fy", lines:[149, 154]}, "after_method:run:":{doc:"Runs / Calls block_or_method_name
everytime after running method_name
.
Example:
\n\n Array after_method: 'inspect run: 'compact!\n x = [1, nil, 2, nil, 3]\n x inspect # => \"[1, nil, 2, nil, 3]\"\n x inspect # => \"[1, 2, 3]\"\n\n # Or pass a Block:\n Array after_method: 'inspect run: @{ compact! }\n
\n\n \n\n", arg:["method_name", "block_or_method_name"], file:"lib/class.fy", lines:[387, 405]}, "missing_methods_for_interface:":{doc:"\n\n \n\n", arg:["methods"], file:"lib/contracts.fy", lines:[63, 71]}, ":methods":{doc:"Forward to message methods:
\n\n\n\n", arg:[], file:"lib/rbx/class.fy", lines:[197, 205]}, "instance_method:":{doc:"Returns an instance method for a Class
with a given name.
Runs / Calls block_or_method_name
everytime before & after running method_name
.
Example:
\n\n class MyController {\n def do_stuff {\n \"Doing stuff\" println\n }\n\n def log_data {\n \"Log data\" println\n }\n\n around_method: 'do_stuff run: 'log_data\n }\n\n controller = MyController new\n controller do_stuff\n\n # which will print:\n # Log data\n # Doing stuff\n # Log data\n\n # Or pass a Block:\n MyController around_method: 'do_stuff run: { \"Log data\" println }\n
\n\n \n\n", arg:["method_name", "block_or_method_name"], file:"lib/class.fy", lines:[407, 440]}, "public:":{doc:"Sets any given method names to public on this Class
.
Example:
\n\n class MyClass {\n def foo {}\n def bar {}\n\n public: 'foo\n public: 'bar\n\n # same as:\n public: ('foo, 'bar)\n\n # same as:\n public: {\n def foo {}\n def bar {}\n }\n }\n
\n\n \n\n", arg:["public_methods"], file:"lib/class.fy", lines:[83, 115]}, "__private__:":{doc:"Sets any given method names to private on this Class
.
Defines slot reader & writer methods for all given slotnames.
\n\n \n\n", arg:["slots"], file:"lib/class.fy", lines:[193, 204]}, "private:":{doc:"Sets any given method names to private on this Class
.
Example:
\n\n class MyClass {\n def foo {}\n def bar {}\n\n private: 'foo\n private: 'bar\n\n # same as:\n private: ('foo, 'bar)\n\n # same as:\n private: {\n def foo {}\n def bar {}\n }\n }\n
\n\n \n\n", arg:["private_methods"], file:"lib/class.fy", lines:[15, 47]}, "__protected__:":{doc:"Sets any given method names to protected on this Class
.
Removes both reader and writer methods for slots in slotnames
.
Sets any given method names to public on this Class
.
Sets any given method names to protected on this Class
.
Example:
\n\n class MyClass {\n def foo {}\n def bar {}\n\n protected: 'foo\n protected: 'bar\n\n # same as:\n protected: ('foo, 'bar)\n\n # same as:\n protected: {\n def foo {}\n def bar {}\n }\n }\n
\n\n \n\n", arg:["protected_methods"], file:"lib/class.fy", lines:[49, 81]}, ":initialize":{doc:"Initializes a Class
with Object
set as superclass (default superclass).
Defines a slot reader method with a given name.\nE.g. for a slotname count
it will define the following method:
def count {\n get_slot: 'count\n }\n
\n\n \n\n", arg:["slotname"], file:"lib/class.fy", lines:[117, 131]}, ":instance_methods":{doc:"Forward to message instance_methods:
\n\n\n\n", arg:[], file:"lib/rbx/class.fy", lines:[188, 196]}, "define_slot_writer:":{doc:"Defines a slot writer method with a given name.\nE.g. for a slotname count
it will define the following method:
def count: c {\n set_slot: 'count value: c\n }\n
\n\n \n\n", arg:["slotname"], file:"lib/class.fy", lines:[133, 147]}, "alias_method:for:":{doc:"Defines an alias method for another method.
\n\n \n\n", arg:["new_method_name", "old_method_name"], file:"lib/class.fy", lines:[269, 278]}, "instance_methods:":{doc:"\n\n \n\n", arg:["include_superclasses?"], file:"lib/rbx/class.fy", lines:[189, 196]}, "read_slots:":{doc:"Defines slot reader methods for all given slotnames.
\n\n \n\n", arg:["slots"], file:"lib/class.fy", lines:[149, 159]}, "read_slot:":{doc:"Defines a slot reader method for a given slotname.
\n\n \n\n", arg:["slotname"], file:"lib/class.fy", lines:[161, 169]}, ":new":{doc:"Creates a new instance of self
calling initialize
.
Defines slot writer methods for all given slotnames.
\n\n \n\n", arg:["slots"], file:"lib/class.fy", lines:[171, 181]}}, methods:{"superclass:body:":{doc:"Creates a new Class
by subclassing superclass
and\nusing body_block
as its body.
TrueClass. The class of the singleton true
value.
Calls block
with self
.
Calls then_block
with self
.
NilClass. The class of the singleton nil
value.
Calls then_block
with self
.
Calls else_block
.
Calls block
with self
.
FalseClass. The class of the singleton false
value.
Calls else_block
with self
.
Boolean negation of false
=> true
.
Calls block
with self
.
Calls else_block
.
Calls then_block
with self
.
Mixin-Class with useful methods for collections that implement an each:
method.
Example:
\n\n (1,2,3,4) last: 2 # => [3,4]\n
\n\n \n\n", arg:["amount"], file:"lib/enumerable.fy", lines:[111, 126]}, "join_by:":{doc:"Works similar to Fancy
Enumerable
inject:into:
but uses first element as value injected.
Example:
\n\n (1,2,3) join_by: '+ # => same as: (2,3) inject: 1 into: '+\n
\n\n \n\n", arg:["block"], file:"lib/enumerable.fy", lines:[181, 194]}, "for_every:do:":{doc:"Calls block
with item
for each occurance of item
in self
.
Example:
\n\n count = 0\n [1,2,3,2,1] for_every: 1 do: { count = count + 1 }\n # count is now 2\n
\n\n \n\n", arg:["item", "block"], file:"lib/enumerable.fy", lines:[309, 325]}, "drop_while:":{doc:"Similar to take_while:
but inverse.\nReturns a new Array
by skipping elements from the beginning\nas long as they meet the given condition block.
Example:
\n\n [1,2,3,4,5] drop_while: |x| { x < 4 } # => [4,5]\n
\n\n\n\n", arg:["condition"], file:"lib/enumerable.fy", lines:[464, 490]}, "reduce:init_val:":{doc:"Calculates a value based on a given block to be called on an accumulator\nvalue and an initial value.
\n\nExample:
\n\n [1,2,3] reduce: |sum val| { sum + val } init_val: 0 # => 6\n
\n\n\n\n", arg:["block", "init_val"], file:"lib/enumerable.fy", lines:[538, 552]}, ":product":{doc:"Calculates the product of all the elements in the Enumerable
\n(assuming them to be Number
s (implementing +
& *
)).
Example:
\n\n (0..10) count: @{ even? } # => 6 (even numbers are: 0,2,4,6,8,10)\n [1,2,3] count: @{ odd? } # => 2\n [1,2, \"foo\"] count: @{ class == String } # => 1\n
\n\n \n\n", arg:["block"], file:"lib/enumerable.fy", lines:[970, 986]}, ":fourth":{doc:"\n\n \n\n", arg:[], file:"lib/enumerable.fy", lines:[65, 71]}, "join:":{doc:"Joins a collection with a String
between each element, returning a new String
.
Example:
\n\n \"hello, world\" join: \"-\" # => \"h-e-l-l-o-,- -w-o-r-l-d\"\n
\n\n \n\n", arg:["str"], file:"lib/enumerable.fy", lines:[161, 179]}, "last_index_of:":{doc:"Returns the last index for item
in self
, or nil
, if item
is not in self
.
Returns a new Array
with all values removed that are nil
( return true
on nil?
).
Example:
\n\n [1,2,nil,3,nil] compact # => [1,2,3]\n
\n\n \n\n", arg:[], file:"lib/enumerable.fy", lines:[609, 620]}, ":average":{doc:"\n\n \n\n", arg:[], file:"lib/enumerable.fy", lines:[758, 765]}, ":random":{doc:"\n\n \n\n", arg:[], file:"lib/enumerable.fy", lines:[826, 832]}, ":sorted?":{doc:"Example:
\n\n (1,2,3) sorted? # => true\n (2,1,3) sorted? # => false\n \"abc\" sorted? # => true\n \"bac\" sorted? # => false\n
\n\n \n\n", arg:[], file:"lib/enumerable.fy", lines:[1001, 1020]}, "drop:":{doc:"Example:
\n\n [1,2,3,4,5] drop: 2 # => [3,4,5]\n
\n\n \n\n", arg:["amount"], file:"lib/enumerable.fy", lines:[508, 522]}, "partition_by:":{doc:"Example:
\n\n (0..10) partition_by: @{ < 3 } # => [[0, 1, 2], [3, 4, 5, 6, 7, 8, 9, 10]]\n
\n\n \n\n", arg:["block"], file:"lib/enumerable.fy", lines:[767, 790]}, "split_at:":{doc:"Example:
\n\n [1,2,3,4,5] split_at: 2 # => [[1,2], [3,4,5]]\n
\n\n \n\n", arg:["index"], file:"lib/enumerable.fy", lines:[1022, 1032]}, "first:":{doc:"Example:
\n\n (1,2,3,4) first: 2 # => [1,2]\n
\n\n \n\n", arg:["amount"], file:"lib/enumerable.fy", lines:[95, 109]}, ":join":{doc:"Forward to message join:
\n\n\n\n", arg:[], file:"lib/enumerable.fy", lines:[160, 179]}, ":empty?":{doc:"Indicates, if the Enumerable is empty (has no elements).
\n\n \n\n", arg:[], file:"lib/enumerable.fy", lines:[599, 607]}, "split_with:":{doc:"Example:
\n\n [1,2,3,4,5] split_with: @{ < 3 } # => [[1, 2], [3, 4, 5]]\n
\n\n \n\n", arg:["predicate_block"], file:"lib/enumerable.fy", lines:[1034, 1044]}, ":first":{doc:"\n\n \n\n", arg:[], file:"lib/enumerable.fy", lines:[41, 47]}, "map_chained:":{doc:"Example:
\n\n (1,2,3) map_chained: (@{ + 1 }, 'to_s, @{ * 2 })\n # => [\"22\", \"33\", \"44\"]\n
\n\n \n\n", arg:["blocks"], file:"lib/enumerable.fy", lines:[370, 385]}, "superior_by:":{doc:"Forward to message superior_by:taking:
\n\n\n\n", arg:["comparison_block"], file:"lib/enumerable.fy", lines:[621, 653]}, "chunk_by:":{doc:"Similar to Fancy
Enumerable
partition_by:
but includes the value of\ncalling block
with an element within the chunk.
Example:
\n\n [1,3,4,5,6,8,10] chunk_by: 'odd?\n # => [[true, [1,3]], [false, [4]], [true, [5]], [false, [6,8,10]]]\n
\n\n \n\n", arg:["block"], file:"lib/enumerable.fy", lines:[792, 824]}, "includes?:":{doc:"Indicates, if a collection includes a given element.
\n\n \n\n", arg:["item"], file:"lib/enumerable.fy", lines:[128, 137]}, "any?:":{doc:"Indicates, if any element meets the condition.
\n\n \n\n", arg:["condition"], file:"lib/enumerable.fy", lines:[196, 210]}, "superior_by:taking:":{doc:"Returns the superior element in the Fancy
Enumerable
that has met\nthe given comparison block with all other elements,\napplied to whatever selection_block
returns for each element.
Examples:
\n\n [1,2,5,3,4] superior_by: '> # => 5\n [1,2,5,3,4] superior_by: '< # => 1\n [[1,2], [2,3,4], [], [1]] superior_by: '> taking: 'size # => [2,3,4]\n [[1,2], [2,3,4], [-1]] superior_by: '< taking: 'first # => [-1]\n
\n\n \n\n", arg:["comparison_block", "selection_block"], file:"lib/enumerable.fy", lines:[622, 653]}, "grep:":{doc:"Example:
\n\n \"hello world\" grep: /[a-h]/ # => [\"h\", \"e\", \"d\"]\n [\"hello\", \"world\", 1, 2, 3] grep: String # => [\"hello\", \"world\"]\n
\n\n \n\n", arg:["pattern"], file:"lib/enumerable.fy", lines:[1046, 1057]}, ":last":{doc:"Returns the last element in a Fancy
Enumerable
.
Similar to each:
but calls an additional Block
between\ncalling the first Block
for each element in self.
Example:
\n\n result = \"\"\n [1,2,3,4,5] each: |i| {\n result << i\n } in_between: {\n result << \"-\"\n }\n result # => \"1-2-3-4-5\"\n
\n\n\n\n", arg:["each_block", "between_block"], file:"lib/enumerable.fy", lines:[139, 159]}, "flat_map:":{doc:"Similar to Fancy
Enumerable
map:
but returns the result Array
flattened.
Example:
\n\n \"hello world\" grep: /[a-h]/ taking: @{ upcase } # => [\"H\", \"E\", \"D\"]\n [\"hello\", \"world\", 1, 2, 3] grep: String taking: 'upcase # => [\"HELLO\", \"WORLD\"]\n
\n\n \n\n", arg:["pattern", "block"], file:"lib/enumerable.fy", lines:[1059, 1077]}, "at:":{doc:"Example:
\n\n \"foo\\\xE2\x80\x9D at: 2 # => \"o\"\n \"foo\\\xE2\x80\x9D at: 3 # => nil\n
\n\n \n\n", arg:["index"], file:"lib/enumerable.fy", lines:[9, 23]}, "all?:":{doc:"Takes condition-block and returns true
if all elements meet it.
Returns a new Array with all unique values (double entries are skipped).
\n\nExample:
\n\n [1,2,1,2,3] unique # => [1,2,3]\n
\n\n \n\n", arg:[], file:"lib/enumerable.fy", lines:[566, 583]}, "one?:":{doc:"Example:
\n\n (0,1,2) one?: 'odd? # => true\n (0,1,2) one?: 'even? # => false\n
\n\n \n\n", arg:["block"], file:"lib/enumerable.fy", lines:[1079, 1097]}, "select_with_index:":{doc:"Returns a new Array
with all elements and their indices that meet the given\ncondition block. condition
is called with each element and its index in self
.
Sorts a collection by a given comparison block.
\n\n \n\n", arg:["comparison_block"], file:"lib/enumerable.fy", lines:[834, 843]}, "reject:":{doc:"Similar to select:
but inverse.\nReturns a new Array
with all elements that don't meet the given condition block.
Returns the size of an Enumerable.
\n\n \n\n", arg:[], file:"lib/enumerable.fy", lines:[585, 597]}, ":max":{doc:"Returns the maximum value in the Enumerable (via the '>' comparison message).
\n\n \n\n", arg:[], file:"lib/enumerable.fy", lines:[655, 663]}, "max_by:":{doc:"Returns the maximum value in the Enumerable (via the '>' comparison message).
\n\nExample:
\n\n [[1,2,3], [1,2], [1]] max_by: @{ size } # => [1,2,3]\n
\n\n \n\n", arg:["block"], file:"lib/enumerable.fy", lines:[665, 677]}, "sort_by:":{doc:"Sorts a collection by calling a Block
with every element\nand using the return values for comparison.
Example:
\n\n [\"abc\", \"abcd\", \"ab\", \"a\", \"\"] sort_by: @{ size }\n # => [\"\", \"a\", \"ab\", \"abc\", \"abcd\"]\n
\n\n \n\n", arg:["block"], file:"lib/enumerable.fy", lines:[845, 861]}, "none?:":{doc:"Example:
\n\n (0,2,4) none?: 'odd? # => true\n (0,2,5) none?: 'odd? # => false\n
\n\n \n\n", arg:["block"], file:"lib/enumerable.fy", lines:[1099, 1110]}, "map:":{doc:"Returns a new Array
with the results of calling a given block for every element.
Same as reduce:init_val: but taking the initial value as first\nand the reducing block as second parameter.
\n\nExample:
\n\n [1,2,3] inject: 0 into: |sum val| { sum + val } # => 6\n
\n\n\n\n", arg:["val", "block"], file:"lib/enumerable.fy", lines:[554, 564]}, "min_by:":{doc:"Returns the minimum value in the Enumerable (via the '<' comparison message).
\n\nExample:
\n\n [[1,2,3], [1,2], [1]] min_by: @{ size } # => [1]\n
\n\n \n\n", arg:["block"], file:"lib/enumerable.fy", lines:[689, 701]}, "in_groups_of:":{doc:"Example usage:
\n\n [1,2,3,4,5] in_groups_of: 3 # => [[1,2,3],[4,5]]\n
\n\n \n\n", arg:["size"], file:"lib/enumerable.fy", lines:[863, 893]}, "find:":{doc:"Returns nil
, if item
(or anything that returns true
when comparing to item
) isn't found.\nOtherwise returns that element that is equal to item
.
Returns the minimum value in the Enumerable (via the '<' comparison message).
\n\n \n\n", arg:[], file:"lib/enumerable.fy", lines:[679, 687]}, ":min_max":{doc:"If self
is empty, returns (nil, nil).
Example:
\n\n (1,2,3,4) min_max # => (1, 3)\n
\n\n \n\n", arg:[], file:"lib/enumerable.fy", lines:[703, 714]}, ":to_s":{doc:"Example:
\n\n (1,2,3) to_s # => \"123\"\n [1,2,3] to_s # => \"123\"\n \"foo\" to_s # => \"foo\"\n
\n\n \n\n", arg:[], file:"lib/enumerable.fy", lines:[988, 999]}, "find_by:":{doc:"Similar to find:
but takes a block that is called for each element to find it.
Example:
\n\n [1,2,3,4,5] find_by: @{ even? } # => 2\n [1,2,3,4,5] find_by: @{ odd? } # => 1\n [1,2,3,4,5] find_by: @{ % 3 == 0 } # => 3\n
\n\n\n\n", arg:["block"], file:"lib/enumerable.fy", lines:[261, 277]}, "map_with_index:":{doc:"Returns a new Array
with the results of calling a given block for every element and its index.
Returns a new Array
with all elements that meet the given condition block.
Example:
\n\n [1,2,3,4] take: 2 # => [1,2]\n
\n\n \n\n", arg:["amount"], file:"lib/enumerable.fy", lines:[492, 506]}, "min_max_by:":{doc:"Calls block
with each element in self
to determine min and max values.\nIf self
is empty, returns (nil, nil).
Example:
\n\n (\"a\", \\\xE2\x80\x9Dbc\", \\\xE2\x80\x9Ddef\") min_max_by: 'size # => (1, 3)\n
\n\n \n\n", arg:["block"], file:"lib/enumerable.fy", lines:[716, 738]}, "group_by:":{doc:"Returns the elements grouped by block
in a Hash
(the keys being the\nvalue of calling block
with the elements).
Example:
\n\n ('foo, 1, 2, 'bar) group_by: @{ class }\n # => <[Symbol => ['foo, 'bar], Fixnum => [1,2]]>\n
\n\n \n\n", arg:["block"], file:"lib/enumerable.fy", lines:[895, 914]}, "find:do:":{doc:"Calls block
with item
, if found.\nIf item
is not in self
, block
is not called.
Example:
\n\n [1,2,3,4,5] drop: 2 # => [3,4,5]\n
\n\n \n\n", arg:["amount"], file:"lib/enumerable.fy", lines:[508, 522]}, ":to_a":{doc:"Default implementation for converting Fancy
Enumerable
s into Array
s.
Calls block
with item
and its index in self
, if found.\nIf item
is not in self
, block
is not called.
Forward to message drop_last:
\n\n\n\n", arg:[], file:"lib/enumerable.fy", lines:[525, 536]}, "to_hash:":{doc:"Example:
\n\n [\"foo\", \\\xE2\x80\x9Dhello\", \"ok\", \"\"] to_hash: @{ size }\n # => <[3 => \"foo\", 5 => \"hello\", 2 => \"ok\", 0 => \"\"]>\n
\n\n \n\n", arg:["block"], file:"lib/enumerable.fy", lines:[940, 956]}, "each_with_index:":{doc:"Iterate over all elements in self
.\nCalls a given Block
with each element and its index.
Calls block
with item
and each of its indexes in self
, if item
is in self
.
Returns a new Array
by taking elements from the beginning\nas long as they meet the given condition block.
Example:
\n\n [1,2,3,4,5] take_while: |x| { x < 4 } # => [1,2,3]\n
\n\n \n\n", arg:["condition"], file:"lib/enumerable.fy", lines:[441, 462]}, "drop_last:":{doc:"Example:
\n\n [1,2,3,4] drop_last: 2 # => [1,2]\n
\n\n \n\n", arg:["amount"], file:"lib/enumerable.fy", lines:[526, 536]}, ":sum":{doc:"Calculates the sum of all the elements in the Enumerable
\n(assuming them to be Number
s (implementing '+' & '*')).
Returns self
in reverse order.\nThis only makes sense for collections that have an ordering.\nIn either case, it simply converts self
to an Array
and returns it in reversed order.
Runs block
for each element on reversed version of self.\nIf self
is not a sorted collection, no guarantees about the reverse order can be given.
Strings are sequences of characters and behave as such.\nAll literal Strings within Fancy code are instances of the String\nclass.
\n\nThey also include Fancy
Enumerable
, which means you can use all the\ncommon sequence methods on them, like Fancy
Enumerable
map:
, Fancy
Enumerable
select:
etc.
Example:
\n\n \"HELLO WORLD\" lowercase # => \"hello world\"\n
\n\n \n\n", file:"kernel/common/string.rb", lines:[279, 284]}, ":characters":{doc:"\n\n \n\n", arg:[], file:"lib/string.fy", lines:[158, 164]}, ":character":{doc:"\n\n \n\n", arg:[], file:"lib/string.fy", lines:[166, 175]}, "relative_path:":{doc:"Example:
\n\n __FILE__ relative: \"../foo/bar\"\n
\n\n \n\n", arg:["path"], file:"lib/string.fy", lines:[189, 199]}, ":multiline?":{doc:"Example:
\n\n \"foo\n
\n\nbar\" multiline? # => true
\n\n \"foo bar\" multiline? # => false\n \"\" multiline? # => false\n \"\n
\n\n\" multiline? # => true
\n\n \n\n", arg:[], file:"lib/string.fy", lines:[197, 213]}, ":main?":{doc:"\n\n \n\n", arg:[], file:"lib/string.fy", lines:[215, 221]}, "if_main:":{doc:"Forward to message if_main:else:
\n\n\n\n", arg:["main_block"], file:"lib/string.fy", lines:[222, 233]}, ":*":{doc:"Returns a String
that is the num-fold concatenation of itself.
Example:
\n\n \"foo\" * 3 # => \"foofoofoo\"\n
\n\n \n\n", arg:["num"], file:"lib/string.fy", lines:[66, 82]}, "if_main:else:":{doc:"Same as:
\n\n if: main? then: else_block else: else_block\n
\n\n \n\n", arg:["main_block", "else_block"], file:"lib/string.fy", lines:[223, 233]}, ":snake_cased":{doc:"Returns a snake cased version of self
.
Returns camel cased version of self
which is expected\nto be a snake cased String
.
Given an Array of 2 Numbers, it returns the substring between the given indices.\nIf given a Number, returns the character at that index.
\n\n\n\n", arg:["index"], file:"lib/rbx/string.fy", lines:[18, 30]}, ":uppercase?":{doc:"Example:\n \"F\" uppercase? # => true\n \"FOO\" uppercase? # => true\n \"f\\\xE2\x80\x9D uppercase? # => false\n \"Foo\" uppercase? # => false
\n\n \n\n", arg:[], file:"lib/string.fy", lines:[254, 267]}, ":lowercase?":{doc:"Example:\n \"f\\\xE2\x80\x9D lowercase? # => true\n \"foo\" lowercase? # => true\n \"F\" lowercase? # => false\n \"Foo\" lowercase? # => false
\n\n \n\n", arg:[], file:"lib/string.fy", lines:[269, 282]}, ":uppercase":{doc:"Example:
\n\n \"hello world\" uppercase # => \"HELLO WORLD\"\n
\n\n \n\n", file:"kernel/common/string.rb", lines:[726, 731]}, ":lowercase":{doc:"Example:
\n\n \"HELLO WORLD\" lowercase # => \"hello world\"\n
\n\n \n\n", file:"kernel/common/string.rb", lines:[279, 284]}, ":bytes":{doc:"\n\n \n\n", arg:[], file:"lib/string.fy", lines:[177, 187]}, ":++":{doc:"Concatenate self
with another Object's String
representation.
\"foo\\\xE2\x80\x9D ++ 42 # => \\\xE2\x80\x9Dfoo42\\\xE2\x80\x9D\n
\n\n \n\n", arg:["other"], file:"lib/string.fy", lines:[31, 41]}, "==":{doc:"Compares self
to another String
and returns true
, if equal, false
otherwise.
Example:
\n\n \"hello world\" uppercase # => \"HELLO WORLD\"\n
\n\n \n\n", file:"kernel/common/string.rb", lines:[726, 731]}, "lowercase":{doc:"Example:
\n\n \"HELLO WORLD\" lowercase # => \"hello world\"\n
\n\n \n\n", file:"kernel/common/string.rb", lines:[279, 284]}, "from:to:":{doc:"Returns a Substring from from
to to
.
Compares self
to another String
and returns true
, if equal, false
otherwise.
Returns the lines of a String
as an Array
.
Splits a string by whitespace.
\n\n \n\n", arg:[], file:"lib/rbx/string.fy", lines:[71, 78]}, "downcase":{doc:"Example:
\n\n \"HELLO WORLD\" lowercase # => \"hello world\"\n
\n\n \n\n", file:"kernel/common/string.rb", lines:[279, 284]}, ":eval_global":{doc:"Same as String#eval
but evaluates self
in the global binding.
Example:
\n\n \"hello world\" uppercase # => \"HELLO WORLD\"\n
\n\n \n\n", file:"kernel/common/string.rb", lines:[726, 731]}, ":raise!":{doc:"Raises a new StandardError
with self as the message.
Indicates if a given substring is in self
.
Returns the character (as a String
) at index idx
.
Evaluates a String
in the current Binding
and returns its value.
Appends object's
String
representation to self
.
Example:
\n\n str = \"hello\"\n str << \" \"\n str << 42\n str # => \"hello 42\"\n
\n\n \n\n", arg:["object"], file:"lib/string.fy", lines:[124, 139]}, "each:":{doc:"Calls a given Block
with each character in a String
.
Appends another String
onto this String
.
Example usage:\n str = \"hello\"\n str append: \" world!\"\n str # => \"hello world!\"
\n\n \n\n", arg:["string"], file:"lib/rbx/string.fy", lines:[130, 144]}, "substitute:with:":{doc:"\n\n \n\n", arg:["substring", "substitution"], file:"lib/rbx/string.fy", lines:[157, 165]}, ":whitespace?":{doc:"Indicates, if a String
is empty or a single whitespace character.
Indicates, if a String
consists only of whitespace.
Example:
\n\n \"hello world\" words # => [\"hello\", \"world\"]\n
\n\n \n\n", arg:[], file:"lib/string.fy", lines:[84, 93]}, ":rest":{doc:"Returns a String
containing all but the first character.
\"hello\" rest # => \"ello\"\n
\n\n \n\n", arg:[], file:"lib/string.fy", lines:[103, 112]}, ":upcase":{doc:"Example:
\n\n \"hello world\" uppercase # => \"HELLO WORLD\"\n
\n\n \n\n", file:"kernel/common/string.rb", lines:[726, 731]}, ":skip_leading_indentation":{doc:"Remove leading white space for multi-line strings.\nThis method expects the first character to be an line return.
\n\n\n\n", arg:[], file:"lib/string.fy", lines:[141, 156]}}, methods:{}, ancestors:["String", "Fancy Enumerable", "Object", "BasicObject", "Comparable", "Object", "Kernel", "BasicObject"]}, "Array":{doc:"Array class.\nArrays are dynamically resizable containers with a constant-time\nindex-based access to members.
\n\n\n\n", instance_methods:{"last:":{doc:"Returns new Array with last n elements specified.
\n\n \n\n", arg:["count"], file:"lib/rbx/array.fy", lines:[107, 115]}, "join:":{doc:"Joins all elements in the Array with a given String
.
Example:
\n\n [1,2,3] join: \", \\\xE2\x80\x9D # => \\\xE2\x80\x9D1, 2, 3\"\n
\n\n \n\n", arg:["join_str"], file:"lib/rbx/array.fy", lines:[117, 129]}, ":clone":{doc:"Clones (shallow copy) the Array
.
Joins all elements with the empty String
.
Example:
\n\n [\"hello\", \"world\", \"!\"] join # => \"hello,world!\"\n
\n\n \n\n", arg:[], file:"lib/rbx/array.fy", lines:[131, 142]}, "unshift:":{doc:"Inserts a value at the front of self
.
Example:
\n\n a = [1,2,3]\n a unshift: 10\n a # => [10,1,2,3]\n
\n\n \n\n", arg:["value"], file:"lib/rbx/array.fy", lines:[144, 158]}, ":*":{doc:"Returns a new Array
that contains the elements of self num times\nin a row.
Given an Fancy
Enumerable
of 2 Fixnum
s, it returns the sub-array between the given indices.\nIf given a single Fixnum
, returns the element at that index.
Prepends another Array
to this one.
Example:
\n\n a = [1,2,3]\n a prepend: [4,5,6]\n a # => [4,5,6,1,2,3]\n
\n\n \n\n", arg:["arr"], file:"lib/array.fy", lines:[53, 70]}, ":=?":{doc:"Compares two Arrays where order does not matter.
\n\n \n\n", arg:["other"], file:"lib/array.fy", lines:[130, 145]}, "values_at:":{doc:"Returns new Array
with elements at given indices.
Returns new Array with elements of other_arr appended to these.
\n\n \n\n", arg:["other_arr"], file:"lib/array.fy", lines:[195, 205]}, "select!:":{doc:"Removes all elements in place, that don't meet the condition.
\n\n \n\n", arg:["condition"], file:"lib/array.fy", lines:[207, 217]}, "reject!:":{doc:"Same as Array#reject: but doing so in-place (destructive).
\n\n\n\n", arg:["block"], file:"lib/array.fy", lines:[219, 226]}, "remove:":{doc:"Removes all occurances of obj in the Array.
\n\n \n\n", arg:["obj"], file:"lib/array.fy", lines:[239, 248]}, "remove_if:":{doc:"Like Array
remove:
, but taking a condition Block
.\nRemoves all elements that meet the given condition Block
.
Returns an Array of all indices of this item. Empty Array if item does not occur.
\n\n [1, 'foo, 2, 'foo] indices_of: 'foo # => [1, 3]\n
\n\n \n\n", arg:["item"], file:"lib/array.fy", lines:[354, 368]}, ":indices":{doc:"Returns an Array
of all the indices of an Array
.
[1,2,3] indices # => [0,1,2]\n
\n\n \n\n", arg:[], file:"lib/array.fy", lines:[343, 352]}, ":to_hash":{doc:"Returns a Hash
with each key-value pair in self
.\nExpects values in self
to be 2-element Array
s (used as key-value pairs).
Example:
\n\n [[1,2],[3,4]] to_hash # => <[1 => 2, 3 => 4]>\n
\n\n\n\n", arg:[], file:"lib/array.fy", lines:[392, 406]}, ":to_a":{doc:"\n\n \n\n", arg:[], file:"lib/array.fy", lines:[294, 300]}, ":compact!":{doc:"Removes all nil-value elements in place.
\n\n \n\n", arg:[], file:"lib/array.fy", lines:[228, 237]}, "from:to:":{doc:"Returns sub-array starting at from: and going to to:
\n\n \n\n", arg:["start", "end"], file:"lib/array.fy", lines:[370, 390]}, "reverse_each:":{doc:"Example:
\n\n [1,2,3] reverse_each: @{print}\n # prints: 321\n
\n\n \n\n", arg:["block"], file:"lib/array.fy", lines:[114, 128]}, ":inspect":{doc:"Returns a pretty-printed String
representation of self
.\nExample:
[1, 'foo, \"bar\", 42] inspect # => \"[1, 'foo, \\\"bar\\\", 42]\"\n
\n\n \n\n", arg:[], file:"lib/array.fy", lines:[272, 288]}, "includes?:":{doc:"Indicates, if an Array includes a given value.
\n\n \n\n", arg:["obj"], file:"lib/rbx/array.fy", lines:[30, 39]}, "remove_at:":{doc:"Removes an element at a given index.\nIf given an Array of indices, removes all the elements with these indices.\nReturns the deleted object if an index was given, the last deleted object for an Array given.
\n\n\n\n", arg:["index"], file:"lib/rbx/array.fy", lines:[41, 63]}, ":println":{doc:"Prints each element on a seperate line.
\n\n\n\n", arg:[], file:"lib/array.fy", lines:[263, 270]}, "at:":{doc:"Returns the element in the Array
at a given index.
Returns an Array
of all values in self
that are not in other
.
Example:
\n\n [1,2,3,4] - [2,4,5] # => [1,3]\n
\n\n \n\n", arg:["other"], file:"lib/array.fy", lines:[329, 341]}, "each:":{doc:"Calls a given Block
with each element in the Array
.
Appends another Array
onto this one.
Example:
\n\n a = [1,2,3]\n a append: [3,4,5]\n a # => [1,2,3,3,4,5]\n
\n\n \n\n", arg:["arr"], file:"lib/array.fy", lines:[34, 51]}, "find:":{doc:"Returns the item, if it's in the Array or nil (if not found).
\n\n \n\n", arg:["item"], file:"lib/array.fy", lines:[147, 162]}, "find_by:":{doc:"Like find: but takes a block that gets called with each element to find it.
\n\n \n\n", arg:["block"], file:"lib/array.fy", lines:[164, 178]}, "[]:":{doc:"Inserts a given object at a given index (position) in the Array.
\n\n \n\n", arg:["idx", "obj"], file:"lib/rbx/array.fy", lines:[78, 88]}, "at:put:":{doc:"Inserts a given object at a given index (position) in the Array.
\n\n \n\n", arg:["idx", "obj"], file:"lib/rbx/array.fy", lines:[78, 88]}, ":rest":{doc:"Returns all elements except the first one as a new Array
.
Returns the index of an item (or nil, if it isn't in the Array
).\nIf item
is a Block
, it will return the index of an element for which it yields true
.
Returns concatenation with another Fancy
Enumerable
.
Example:
\n\n [1,2,3] + [3,4,5] # => [1,2,3,3,4,5]\n
\n\n \n\n", arg:["other"], file:"lib/array.fy", lines:[315, 327]}}, methods:{":===":{doc:"Matches an Array
against another object.
Creates a new Array with a given size and default-value.\nIf default
is a Block
, call it with each index instead and\nstore the return value.
Example:
\n\n Array new: 3 with: 'hello # => ['hello, 'hello, 'hello]\n # default can also be a block, taking the current index.\n Array new: 3 with: @{ * 2 } # => [0, 2, 4]\n
\n\n \n\n", arg:["size", "default"], file:"lib/rbx/array.fy", lines:[8, 28]}, "new:":{doc:"Creates a new Array with a given size
(default value is nil
).
Class of Range values. Are created by using Range literal syntax in Fancy.
\n\nExample:
\n\n (10..100) # Range from 10 to 100\n # the following code does the same as above:\n Range new: 10 to: 100\n
\n\n\n\n", instance_methods:{"each:":{doc:"Calls block
on each value in self
. Used for iterating over a Range
.
Same as Range#inspect
\n\n\n\n", arg:[], file:"lib/range.fy", lines:[13, 19]}, "initialize:to:":{doc:"Initializes a new Range starting at start
and ending at end
.
Tuples are fixed-size containers providing index-based access to its\nelements.
\n\n\n\n", instance_methods:{":inspect":{doc:"\n\n \n\n", arg:[], file:"lib/tuple.fy", lines:[127, 140]}, "at:":{doc:"Returns an element at a given indes.\nPossibly throws an Rubinius
ObjectBoundsExceededError
.
Calls a given Block
with each element in the Tuple
.
Returns sub-array starting at from: and going to to:
\n\n \n\n", arg:["from", "to"], file:"lib/tuple.fy", lines:[54, 71]}, "[]:":{doc:"Sets a value for a given index within a Tuple
.
Forwards to Tuple
#at:.
Sets a value for a given index within a Tuple
.
Example:
\n\n (1,2,3) reverse_each: @{print}\n # prints: 321\n
\n\n \n\n", arg:["block"], file:"lib/tuple.fy", lines:[90, 104]}, ":==":{doc:"Compares two Tuple
s with each other.
Matches Tuple
class against an object.\nIf the given object is a Tuple instance, return a Tuple object.
Initializes a new Tuple
with a given amount of element slots.\nE.g. if size
is 2
, creates a 2-Tuple.
Creates a new Tuple
with the values
passed in.
Example:
\n\n Tuple with_values: [1,2,3] # => (1,2,3)\n
\n\n \n\n", arg:["values"], file:"lib/tuple.fy", lines:[11, 26]}, ":name":{doc:"Tuple
\n\n\n\n", arg:[], file:"lib/tuple.fy", lines:[42, 44]}}, ancestors:["Tuple", "Fancy Enumerable", "Object", "BasicObject", "Enumerable", "Object", "Kernel", "BasicObject"]}, "DynamicSlotObject":{doc:"Helper class to dynamically create Object
s with slots defined by sending messages to it.
Example:
\n\n dso = DynamicSlotObject new\n dso name: \"Chris\"\n dso age: 25\n dso country: \"Germany\"\n\n dso object # => Object with slots 'name, 'age and 'country defined\n
\n\n\n\n", instance_methods:{":object":{doc:"\n\n \n\n", arg:[], file:"lib/dynamic_slot_object.fy", lines:[18, 25]}}, methods:{}, ancestors:["DynamicSlotObject", "Fancy BasicObject", "Object", "Kernel", "BasicObject"]}, "DynamicKeyHash":{doc:"Helper class to dynamically create Hash
es with keys and values defined by sending messages to it.
Example:
\n\n dkh = DynamicKeyHash new\n dkh name: \"Chris\"\n dkh age: 25\n dkh country: \"Germany\"\n\n dkh hash # => <['name => \"Chris\", 'age => 25, 'country => \"Germany\"]>\n
\n\n\n\n", instance_methods:{"initialize:":{doc:"\n\n \n\n", arg:["@deep"], file:"lib/dynamic_slot_object.fy", lines:[50, 53]}, ":hash":{doc:"\n\n \n\n", arg:[], file:"lib/dynamic_slot_object.fy", lines:[55, 61]}, ":initialize":{doc:"Forward to message initialize:
\n\n\n\n", arg:[], file:"lib/dynamic_slot_object.fy", lines:[46, 53]}}, methods:{}, ancestors:["DynamicKeyHash", "Fancy BasicObject", "Object", "Kernel", "BasicObject"]}, "DynamicValueArray":{doc:"Helper class to dynamically create Array
s with values defined by sending messages to it.
Example:
\n\n dva = DynamicValueArray new\n dva name: \"Chris\"\n dva age: 25\n dva country: \"Germany\"\n dva something_else\n\n dva array # => [['name, \"Chris\"], ['age, 25], ['country, \"Germany\"], 'something_else]\n
\n\n\n\n", instance_methods:{":array":{doc:"\n\n \n\n", arg:[], file:"lib/dynamic_slot_object.fy", lines:[94, 100]}}, methods:{}, ancestors:["DynamicValueArray", "Fancy BasicObject", "Object", "Kernel", "BasicObject"]}, "Block":{doc:"The Block class (also BlockEnvironment) is the class of all\nBlock-literal values.\nA Block is a piece of unevaluated code, that can be passed around as\nany other value and evaluated by calling the +call+ or +call:+ methods.
\n\nBlocks also work properly with their enclosing environment in that\nthey preserve any local variables that get used within the Block,\neven if the context in which they got defined has been destroyed.\n=> Blocks are proper closures.
\n\nSee: http://en.wikipedia.org/wiki/Closure_(computer_science) for\nmore information.
\n\n\n\n", instance_methods:{":&&":{doc:"Short-circuiting && (boolean AND).
\n\n\n\n", arg:["other_block"], file:"lib/block.fy", lines:[86, 94]}, "unless:":{doc:"Opposite of Block#if:. Calls self
if obj
is false-ish.
Calls a given Block as long as self
yields nil
or false
.
Creates and returns a new Hash
with keys and values defined dynamically in self
.\nSimilar to Block
to_hash
but converting any value that's a Block
to a Hash
as well.
Example:
\n\n o = {\n something: \"foo bar baz\"\n with: 42\n and: {\n another: 'field\n }\n } to_hash_deep # => <['something => \"foo bar baz\", 'with => 42, 'and => <['another => 'field]>]>\n
\n\n\n\n", arg:[], file:"lib/block.fy", lines:[214, 230]}, ":*":{doc:"Runs self
iteration
times.\nSame as: iterations times: self
Example:
\n\n { \"Hello, World\" println } * 2\n # => prints \"Hello, World\" 2 times\n
\n\n \n\n", arg:["iterations"], file:"lib/block.fy", lines:[248, 261]}, "while_do:":{doc:"Calls block
while calling self
yields a true-ish
value.
Executes a given Block
while self evals to nil
or false
.
Example:
\n\n i = 0\n { i >= 10 } while_false: {\n i println\n i = i + 1\n }\n
\n\n\n\n", arg:["block"], file:"lib/block.fy", lines:[17, 30]}, "while_true:":{doc:"Calls block
while calling self
yields a true-ish
value.
Executes a given Block
while self evals to nil
or false
.
Example:
\n\n i = 0\n { i >= 10 } while_false: {\n i println\n i = i + 1\n }\n
\n\n\n\n", arg:["block"], file:"lib/block.fy", lines:[17, 30]}, "until:":{doc:"Calls self
while block
yields nil
or false
.
Same as Block#call:
\n\n\n\n", arg:["args"], file:"lib/block.fy", lines:[145, 151]}, "if:":{doc:"Calls self
if obj
is true-ish.
Creates and returns a new Object
with slots defined dynamically in self
.\nLooks and feels similar to Javascript object literals.
Example:
\n\n o = {\n something: \"foo bar baz\"\n with: 42\n } to_object\n\n o something # => \"foo bar baz\"\n o with # => 42\n
\n\n\n\n", arg:[], file:"lib/block.fy", lines:[153, 169]}, ":===":{doc:"Matches a Block
against another object by calling self
with val
.
Creates and returns a new Object
with slots defined dynamically in self
.\nLooks and feels similar to Javascript object literals.\nNested blocks are converted to objects as well.
Example:
\n\n o = {\n something: \"foo bar baz\"\n with: {\n age: 42\n }\n } to_object_deep\n\n o something # => \"foo bar baz\"\n o with age # => 42\n
\n\n\n\n", arg:[], file:"lib/block.fy", lines:[171, 197]}, "then:":{doc:"Example:
\n\n # prints \"Hello World!\"\n { \"Hello\" print } then: { \"World!\" println }\n
\n\n \n\n", arg:["block"], file:"lib/block.fy", lines:[263, 274]}, "before:":{doc:"Example:
\n\n # prints \"Hello World!\"\n { \"Hello\" print } then: { \"World!\" println }\n
\n\n \n\n", arg:["block"], file:"lib/block.fy", lines:[263, 274]}, "after:":{doc:"Example:
\n\n # prints \"Hello World!\"\n { \"World!\" println } after: { \"Hello\" print }\n
\n\n \n\n", arg:["block"], file:"lib/block.fy", lines:[278, 289]}, ":||":{doc:"Short-circuiting || (boolean OR).
\n\n\n\n", arg:["other_block"], file:"lib/block.fy", lines:[96, 104]}, ":to_block":{doc:"\n\n \n\n", arg:[], file:"lib/block.fy", lines:[291, 297]}, ":call_with_errors_logged":{doc:"Calls self
while logging any errors to stderr
.
Forward to message call_with_errors_logged_to:reraise:
\n\n\n\n", arg:["io"], file:"lib/block.fy", lines:[316, 331]}, "call_with_errors_logged:":{doc:"Calls self
with args
while logging any errors to stderr
.
Forward to message call:with_errors_logged_to:reraise:
\n\n\n\n", arg:["args", "io"], file:"lib/block.fy", lines:[332, 348]}, ":receiver":{doc:"Returns the receiver of the Block
(value for self
)
Calls a Block
with receiver
as the receiver (referenced by self
within the Block).
Example:
\n\n r1 = [1,2,3]\n r2 = \"hello world\"\n b = { self class }\n b call_with_receiver: r1 # => Array\n b call_with_receiver: r2 # => String\n
\n\n \n\n", arg:["receiver"], file:"lib/rbx/block.fy", lines:[50, 65]}, "call_with_errors_logged_to:reraise:":{doc:"Calls self
while logging any errors to io
.
Same as call_with_receiver:
but passing along arguments to the Block
.
Example:
\n\n r1 = [1,2,3]\n r2 = \"hello world\"\n b = |arg| { self to_s + arg }\n b call: [\"foo\"] with_receiver: r1 # => \"123foo\"\n b call: [\"foo\"] with_receiver: r2 # => \"hello worldfoo\"\n
\n\n \n\n", arg:["args", "receiver"], file:"lib/rbx/block.fy", lines:[67, 87]}, ":to_hash":{doc:"Creates and returns a new Hash
with keys and values defined dynamically in self
.\nSimilar to Block
object
but returning a Hash
instead of an Object
Example:
\n\n o = {\n something: \"foo bar baz\"\n with: 42\n } to_hash # => <['something => \"foo bar baz\", 'with => 42]>\n
\n\n\n\n", arg:[], file:"lib/block.fy", lines:[199, 212]}, "receiver:":{doc:"Sets the receiver (value for self
) of a Block
.
Turns a Block
into a Ruby Proc object.
Calls self
with args
while logging any errors to io
.
Creates and returns a new Array
with values defined dynamically in self
.\nSimilar to Block
to_hash
but returning an Array
instead of a Hash
Example:
\n\n a = {\n something: \"foo bar baz\"\n with: 42\n something; else\n } to_a # => [['something, \"foo bar baz\"], ['with, 42], 'something, 'else]\n
\n\n\n\n", arg:[], file:"lib/block.fy", lines:[232, 246]}}, methods:{":name":{doc:"Block
\n\n\n\n", arg:[], file:"lib/block.fy", lines:[141, 143]}}, ancestors:["Block", "Object", "Kernel", "BasicObject"]}, "Fancy BreakIteration":{doc:"Raised to break the current iteration.\nIt is rescued by Block#loop.
\n\nExample:
\n\n 10 times: |i| {\n i println\n if: (i == 3) then: {\n Fancy BreakIteration new raise!\n }\n }\n \"Done!\" println\n
\n\nProduces:
\n\n 0\n 1\n 2\n 3\n Done!\n
\n\n\n\n", instance_methods:{}, methods:{}, ancestors:["Fancy BreakIteration", "StandardError", "Exception", "Object", "Kernel", "BasicObject"]}, "Fancy NextIteration":{doc:"Raised to continue with next iteration (and stopping the current one).\nIt is rescued by Block#loop.
\n\n\n\n", instance_methods:{}, methods:{}, ancestors:["Fancy NextIteration", "StandardError", "Exception", "Object", "Kernel", "BasicObject"]}, "Fancy StopIteration":{doc:"Raised to stop the iteration, in particular by Enumerator#next.\nIt is rescued by Block#loop.
\n\nExample:
\n\n {\n 'Hello println\n Fancy StopIteration new raise!\n 'World println\n } loop\n 'Done! println\n
\n\nProduces:
\n\n Hello\n Done!\n
\n\n\n\n", instance_methods:{":result":{doc:"Returns the return value of the iterator.
\n\no = Object new\ndef o each: block {\n block call: [1]\n block call: [2]\n block call: [3]\n 100\n}
\n\ne = o to_enum\ne next p #=> 1\ne next p #=> 2\ne next p #=> 3\ntry {\n e next\n} catch Fancy StopIteration => ex {\n ex result p #=> 100\n}
\n\n\n\n", arg:[], file:"lib/iteration.fy", lines:[59, 83]}}, methods:{}, ancestors:["Fancy StopIteration", "StandardError", "Exception", "Object", "Kernel", "BasicObject"]}, "Integer":{doc:"Base class for integer values in Fancy.
\n\n\n\n", instance_methods:{"times:offset:":{doc:"Similar to #times: but starts at a given offset.
\n\n \n\n", arg:["block", "offset"], file:"lib/integer.fy", lines:[6, 18]}, "times_try:":{doc:"Forward to message times_try:retry_with:
\n\n\n\n", arg:["block"], file:"lib/integer.fy", lines:[19, 50]}, "times:":{doc:"Calls a given Block
with each number between 0 and self
.
Tries to call a Block
self
amount of times, returning its return\nvalue or raising the last exception raised from block
after self
tries.
Example:
\n\n 2 times_try: {\n # this code will be tried 2 times.\n # if it succeeds the first time, simply return its value, otherwise try once more.\n # if it still fails after 2 attempts, raises the exception thrown (in this case probably an IOError).\n @connection readln\n } retry_with: { @connection reconnect }\n
\n\n \n\n", arg:["block", "retry_block"], file:"lib/integer.fy", lines:[20, 50]}, ":decimals":{doc:"Returns all decimals of an Integer as an Array.
\n\nExample:
\n\n 100 decimals # => [1, 0, 0]\n 12345 decimals # => [1, 2, 3, 4, 5]\n
\n\n \n\n", arg:[], file:"lib/integer.fy", lines:[52, 75]}}, methods:{}, ancestors:["Integer", "Precision", "Numeric", "Comparable", "Object", "Kernel", "BasicObject"]}, "File":{doc:"Instances of File represent files in the filesystem of the operating\nsystem on which Fancy is running.
\n\n\n\n", instance_methods:{":open?":{doc:"Indicates, if a File
is opened.
Indicates, if a File
is a Directory
.
Example:
\n\n f = File open: \"README.txt\"\n f expanded_path # => \"/path/to/README.txt\" (when run from /path/to/)\n
\n\n \n\n", arg:[], file:"lib/file.fy", lines:[165, 175]}, ":newline":{doc:"Writes a newline character to the File
.
Writes a given String
to a File
.
Writes a given argument as a String followed by a newline into the\nFile.
\n\n\n\n", arg:["x"], file:"lib/file.fy", lines:[152, 160]}, "read:":{doc:"\n\n \n\n", arg:["bytes"], file:"lib/rbx/file.fy", lines:[235, 241]}, "modes:":{doc:"Sets the File
access modes Array
.
Writes a given String
to a File
.
Writes a given argument as a String followed by a newline into the\nFile.
\n\n\n\n", arg:["x"], file:"lib/file.fy", lines:[152, 160]}, ":close":{doc:"Closes an opened File
.
Returns the File
access modes Array
.
Deletes a File
with a given filename
.
Indicates if the File
with the given filename
exists.
Creates a new empty file with the given filename
, if it doesn't already exist.
Reads all the contens (in ASCII mode) of a given file and returns\nthem as an Array of lines being read.
\n\n \n\n", arg:["filename"], file:"lib/rbx/file.fy", lines:[54, 64]}, "read:length:":{doc:"Forward to message read:length:offset:
\n\n\n\n", arg:["filename", "length"], file:"lib/rbx/file.fy", lines:[65, 78]}, "read_config:":{doc:"Reads a .fy source file as a config file.
\n\nExample:
\n\n # Given a file config.fy with these contents:\n {\n host: \"127.0.0.1\"\n port: 1234\n names: [\n 'foo,\n 'bar,\n 'baz\n ]\n something_else: {\n another_value: 'foo\n }\n }\n\n # It can be read like so:\n config = File read_config: \"config.fy\"\n\n # config is now:\n <[\n 'host => \"127.0.0.1\",\n 'port => 1234,\n 'names => ['foo, 'bar, 'baz],\n 'something_else: <[\n 'another_value => 'foo\n ]>\n ]>\n
\n\n \n\n", arg:["filename"], file:"lib/file.fy", lines:[113, 150]}, "read:length:offset:":{doc:"Reads all the contens (in ASCII mode) of a given file, length and offset\nand returns them as an Array of lines being read.
\n\n \n\n", arg:["filename", "length", "offset"], file:"lib/rbx/file.fy", lines:[66, 78]}, "eval:":{doc:"\n\n \n\n", arg:["filename"], file:"lib/file.fy", lines:[104, 111]}, "open:":{doc:"Forward to message open:modes:
\n\n\n\n", arg:["filename"], file:"lib/rbx/file.fy", lines:[79, 100]}, "open:modes:":{doc:"Similar to open:modes:with: but takes no Block
argument to be\ncalled with the File
instance.\nReturns the opened File
instead and expects the caller to close
it manually.
Opens a File
for writing and calls block
with it.
Deletes a File
with a given filename
. If an IOError
occurs,\nit gets ignored.
Opens a File
for writing, overwriting old content.
Indicates, if a given path
refers to a Directory
.
Opens a File
for writing, overwriting old content.
Renames a File
on the filesystem.
Opens a File
for appending and calls block
with it.
Opens a File
for reading and calls block
with it.
Opens a File with a given filename
, a modes_arr
(Array
) and a block
.
E.g. to open a File with read access and read all lines and print them to STDOUT:
\n\nFile open: \"foo.txt\" modes: ['read] with: |f| {
\n\n { f eof? } while_false: {\n f readln println\n }\n
\n\n}
\n\n \n\n", arg:["filename", "modes_arr", "block"], file:"lib/rbx/file.fy", lines:[17, 41]}, "absolute_path:":{doc:"\n\n \n\n", arg:["filename"], file:"lib/rbx/file.fy", lines:[166, 173]}, "readlines:":{doc:"Opens & reads a File
and returns all of its lines in an Array
.
Returns the appropriate String
representation of the modes_arr
.
Opens a File
for reading and calls block
with it.
Opens and reads the contents of a File
in binary mode and\nreturns its binary contents as a String
.
Instances of Directory
represent directories in the filesystem of\nthe operating system, in which Fancy is being run.
Deletes a directory with a given name, if it's empty.
\n\n \n\n", arg:["dirname"], file:"lib/rbx/directory.fy", lines:[38, 50]}, "exists?:":{doc:"Indicates, if a Directory exists with a given pathname.
\n\n \n\n", arg:["dirname"], file:"lib/directory.fy", lines:[7, 16]}, "create:":{doc:"Creates a new Directory
on the filesystem, possibly throwing\nIOError Exceptions that might occur.
Creates a new Directory
on the filesystem, ignoring any\nExceptions that might occur.\nBasically works like running mkdir -p
on the shell.
Example:
\n\n Directory list: \"tests/**/*.fy\" # => [\"tests/file1.fy\", \"tests/more/file2.fy\"]\n
\n\n \n\n", arg:["pattern"], file:"lib/rbx/directory.fy", lines:[52, 68]}}, ancestors:["Dir", "Enumerable", "Object", "Kernel", "BasicObject"]}, "Hash":{doc:"Class for Hashes (HashMaps / Dictionaries).\nMaps a key to a value.
\n\n\n\n", instance_methods:{"at:else:":{doc:"Returns the value for a given key.\nIf the key is not found, calls else_block
and returns the value it yields.
Example:
\n\n <['foo => 'bar]> at: 'foo else: { 42 } # => 'bar\n <['foo => 'bar]> at: 'unknown else: { 42 } # => 42\n <['nil => nil]> at: 'nil else: { 'not_found } # => nil\n
\n\n \n\n", arg:["key", "else_block"], file:"lib/hash.fy", lines:[23, 43]}, "fetch:else:":{doc:"Returns the value for a given key.\nIf the key is not found, calls else_block
and returns the value it yields.
Example:
\n\n <['foo => 'bar]> at: 'foo else: { 42 } # => 'bar\n <['foo => 'bar]> at: 'unknown else: { 42 } # => 42\n <['nil => nil]> at: 'nil else: { 'not_found } # => nil\n
\n\n \n\n", arg:["key", "else_block"], file:"lib/hash.fy", lines:[23, 43]}, "initialize:":{doc:"Initializes a new Hash
with default
as a default value.\nIf default
is a Block
, call it with self
and a given key to get its default value.
Example:
\n\n h = <['foo => 'bar]>\n h at: 'foo else_put: { 42 } # => 'bar\n h['foo] # => 'bar\n h at: 'undefined else_put: { 42 } # => 42\n h['undefined] # => 42\n
\n\n \n\n", arg:["key", "else_block"], file:"lib/hash.fy", lines:[47, 65]}, "select_keys:":{doc:"Example:
\n\n h = <['a => 1, 42 => (1,2,3), 'b => \"hello\"]>\n h select_keys: @{ is_a?: Symbol } # => <['a => 1, 'b => \"hello\"]>\n
\n\n \n\n", arg:["block"], file:"lib/hash.fy", lines:[186, 203]}, "reject_keys:":{doc:"Example:
\n\n h = <['a => 1, 42 => (1,2,3), 'b => \"hello\"]>\n h reject_keys: @{ is_a?: Symbol } # => <[42 => (1,2,3)]>\n
\n\n \n\n", arg:["block"], file:"lib/hash.fy", lines:[205, 216]}, ":random_key":{doc:"\n\n \n\n", arg:[], file:"lib/hash.fy", lines:[218, 224]}, "default:":{doc:"Sets the default value to be returned from self
for keys not in self
.\nIf default_value
is a Block
, use its return value (called with the Hash
and a given key).
Returns the value for a given key.
\n\n \n\n", arg:["key"], file:"lib/hash.fy", lines:[12, 21]}, "at:else_put:":{doc:"Example:
\n\n h = <['foo => 'bar]>\n h at: 'foo else_put: { 42 } # => 'bar\n h['foo] # => 'bar\n h at: 'undefined else_put: { 42 } # => 42\n h['undefined] # => 42\n
\n\n \n\n", arg:["key", "else_block"], file:"lib/hash.fy", lines:[47, 65]}, "update_values:":{doc:"Example:
\n\n h = <['name => \"Tom\", 'age => 21 ]>\n h update_values: @{ * 2}\n h # => <['name => \\\xE2\x80\x9DTomTom\\\xE2\x80\x9D, 'age => 42]>\n
\n\n \n\n", arg:["block"], file:"lib/hash.fy", lines:[299, 312]}, "each_key:":{doc:"Calls a given Block
with each key.
Example:
\n\n h = <['name => \"Tom\", 'age => 21 ]>\n h update_keys: @{ to_s * 2}\n h # => <[\"namename\" => \\\xE2\x80\x9DTom\\\xE2\x80\x9D, \"ageage\" => 21]>\n
\n\n \n\n", arg:["block"], file:"lib/hash.fy", lines:[314, 339]}, "each_value:":{doc:"Calls a given Block
with each value.
Creates and returns a new Object
with slot names and values based on keys and values in self
.
Example:
\n\n o = <['name => \"Christopher Bertels\", 'interest => \"programming languages\"]> to_object\n o name # => \"Christopher Bertels\"\n o interest # => 42\n
\n\n \n\n", arg:[], file:"lib/hash.fy", lines:[122, 140]}, "delete:":{doc:"Deletes a key-value pair from self
.
Similar to Hash
to_object
but converting any nested Hash
slots to Object
s as well.
Sends each key-value pair as a message (with one argument) to receiver
.
Example:
\n\n Person = Struct new: ('firstname, 'lastname)\n p = Person new\n <['firstname => \"Tom\", 'lastname => \"Cruise\"]> call: [p]\n\n p firstname # => \"Tom\"\n p lastname # => \"Cruise\"\n
\n\n \n\n", arg:["receiver"], file:"lib/hash.fy", lines:[244, 261]}, ":random":{doc:"Same as Hash
random_value
.
Example:
\n\n <['foo => 1, 'bar => 2, 'baz => 42]> values_at: ('foo, 'baz) # => [1, 42]\n
\n\n \n\n", arg:["keys"], file:"lib/hash.fy", lines:[174, 184]}, "with_updated_keys:":{doc:"\n\n \n\n", arg:["block"], file:"lib/hash.fy", lines:[350, 357]}, "with_value_for_key:do:":{doc:"Forward to message with_value_for_key:do:else:
\n\n\n\n", arg:["key", "block"], file:"lib/hash.fy", lines:[358, 369]}, "includes?:":{doc:"Indicates if a given key is in self
.
Example:
\n\n <['x => 100, 'y => 150]> to_block\n # would be the same as:\n |receiver| {\n receiver tap: @{\n x: 100\n y: 150\n }\n }\n
\n\n \n\n", arg:[], file:"lib/hash.fy", lines:[273, 297]}, "with_value_for_key:do:else:":{doc:"\n\n \n\n", arg:["key", "block", "else_block"], file:"lib/hash.fy", lines:[359, 369]}, "default_for:":{doc:"\n\n \n\n", arg:["key"], file:"lib/rbx/hash.fy", lines:[98, 105]}, "each:":{doc:"Calls a given Block
with each key and value.
Returns an Array
of the key-value pairs in a Hash
.
A simple Set data structure class.
\n\n\n\n", instance_methods:{"initialize:":{doc:"Initialize a new Set with a given collection of values.
\n\n \n\n", arg:["values"], file:"lib/set.fy", lines:[8, 19]}, ":values":{doc:"\n\n \n\n", arg:[], file:"lib/set.fy", lines:[29, 35]}, "remove:":{doc:"Removes a given object from a Set, if available.
\n\n \n\n", arg:["obj"], file:"lib/set.fy", lines:[143, 151]}, ":clear":{doc:"Removes all elements from self
.
Insert a value into the Set.
\n\n \n\n", arg:["value"], file:"lib/set.fy", lines:[81, 91]}, "includes?:":{doc:"Indicates, if the Set includes value
.
Indicates, if the Set includes value
.
Calls a given Block for each element of the Set.
\n\n \n\n", arg:["block"], file:"lib/set.fy", lines:[115, 125]}, ":inspect":{doc:"Returns a detailed String
representation of a Set.
Initialize a new empty Set.
\n\n\n\n", arg:[], file:"lib/set.fy", lines:[21, 27]}, ":empty?":{doc:"Indicates, if a Set is empty.
\n\n \n\n", arg:[], file:"lib/set.fy", lines:[45, 53]}, ":==":{doc:"Indicates, if two Sets are equal.
\n\n \n\n", arg:["other"], file:"lib/set.fy", lines:[55, 69]}, ":to_s":{doc:"Returns a String
representation of a Set.
Initialize a new Set with a given collection of values.
\n\n \n\n", arg:["values"], file:"lib/set.fy", lines:[71, 79]}}, ancestors:["Set", "Fancy Enumerable", "Object", "BasicObject", "Object", "Kernel", "BasicObject"]}, "Symbol":{doc:"Symbols are unique identifiers and only created once.
\n\nIf there are several occurrances of the same Symbol literal within\nFancy code, they all refer to the same Symbol object.
\n\n\n\n", instance_methods:{"call:":{doc:"This allows Symbols to be used like Blocks (e.g. in all methods of Enumerable).
\n\nExample:
\n\n [1, 2, 3] map: 'squared # => [1, 4, 9]\n
\n\n \n\n", arg:["arg"], file:"lib/symbol.fy", lines:[9, 25]}, ":defined?":{doc:"Indicates if a Symbol is defined as a constant in the senders scope.
\n\n \n\n", arg:[], file:"lib/rbx/symbol.fy", lines:[13, 25]}, ":to_sym":{doc:"\n\n \n\n", arg:[], file:"lib/symbol.fy", lines:[65, 71]}, ":to_block":{doc:"Example:
\n\n 'inspect to_block\n # is equal to:\n @{ inspect }\n
\n\n \n\n", arg:[], file:"lib/symbol.fy", lines:[73, 86]}, ":call":{doc:"Sends self
as message to the sender in its context.
Example:
\n\n 'foo call\n # => same as\n self foo\n\n if: x then: 'foo else: 'bar\n # same as:\n if: x then: { self foo } else: { self bar }\n
\n\n\n\n", arg:[], file:"lib/symbol.fy", lines:[27, 46]}}, methods:{}, ancestors:["Symbol", "ImmediateValue", "Object", "Kernel", "BasicObject"]}, "Stack":{doc:"A simple Stack container class.
\n\n\n\n", instance_methods:{"initialize:":{doc:"Initializes a new Stack with a given size.
\n\n \n\n", arg:["size"], file:"lib/stack.fy", lines:[14, 22]}, "push:":{doc:"Pushes a value onto the Stack.
\n\n \n\n", arg:["obj"], file:"lib/stack.fy", lines:[24, 32]}, "each:":{doc:"Calls a given Block
with each element in self
, starting with the top of stack element.
Initializes a new Stack.
\n\n\n\n", arg:[], file:"lib/stack.fy", lines:[6, 12]}, ":<<":{doc:"Pushes a value onto the Stack.
\n\n \n\n", arg:["obj"], file:"lib/stack.fy", lines:[24, 32]}, ":pop":{doc:"Pops the top-of-stack element from the Stack and returns it.
\n\n \n\n", arg:[], file:"lib/stack.fy", lines:[36, 44]}, ":top":{doc:"\n\n \n\n", arg:[], file:"lib/stack.fy", lines:[46, 52]}, ":size":{doc:"\n\n \n\n", arg:[], file:"lib/stack.fy", lines:[54, 60]}, ":empty?":{doc:"Indicates, if the Stack is empty.
\n\n \n\n", arg:[], file:"lib/stack.fy", lines:[62, 70]}}, methods:{}, ancestors:["Stack", "Object", "Kernel", "BasicObject"]}, "Proxies ProxyReceiver":{doc:"A ProxyReceiver is an object which proxies all message sends to it to 2 other objects.\nIt will send each message first to its proxy
instance variable and then to the obj
instance variable.
Initializes a new ProxyReceiver with proxy
for obj
.
Forwards all incoming messages to self
to @proxy
and then @obj
.
A RespondsToProxy is a Proxy that forwards any message sent to it to it's target
instance variable\nonly if it responds to that message. Any messages that target
doesn't respond to simply won't be sent\nand nil
will be returned.
Initializes a new RespondsToProxy for target
.
Forwards all incoming message to self
to @target
\nonly if @target
responds to them.
An ActorProxy is a Proxy that forwards any message sent to it to\nit's target
object as a future send by default. If explicitly sent\nan async message, it will forward the async send to target
,\nreturning nil
instead of a FutureSend
, as expected.
Example:
\n\n ap = ActorProxy new: target_actor\n\n # this:\n f = ap some_future_send: an_arg\n # is the same as:\n f = target_actor @ some_future_send: an_arg\n\n # and this:\n ap @@ some_async_send: another_arg\n # is the same as:\n target_actor @@ some_async_send: another_arg\n
\n\n\n\n", instance_methods:{}, methods:{}, ancestors:["Proxies ActorProxy", "Fancy BasicObject", "Object", "Kernel", "BasicObject"]}, "Proxies DistributingProxy":{doc:"DistributingProxy is a Proxy that round-robin distributes messages to objects\nin a Fancy
Enumerable
specified upon creation.
Example:
\n\n p = DistributingProxy new: [worker1, worker2, worker3, worker4]\n loop: {\n req = @input receive_request\n p handle_request: req # will be forwarded to worker1-4\n }\n
\n\n\n\n", instance_methods:{}, methods:{}, ancestors:["Proxies DistributingProxy", "Fancy BasicObject", "Object", "Kernel", "BasicObject"]}, "Fiber":{doc:"Fiber class. Fibers are cooperatively scheduled coroutines supported\nby the Rubinius VM.\nControl flow between multiple Fibers is always explicitly handled.\nThere is no preemptive scheduler.
\n\n\n\n", instance_methods:{"resume:":{doc:"Resumes self
(if paused) or raises an exception, if Fiber
is dead.\nPasses along vals
as the return value of the last call to yield
in self
.
Fiber
\n\n\n\n", arg:[], file:"lib/fiber.fy", lines:[9, 11]}, "new:":{doc:"Creates a new Fiber running block
.
Returns execution control to the parent Fiber
and passes along vals
.
A FutureSend
gets created whenever an asynchronous message via the @ operator gets sent, yielding a FutureSend
.\nThey represent Futures/Promises in Fancy.
Example:
\n\n f = some_object @ some_method: some_argument\n f class # => FutureSend\n f value # => Value returned by some_method, but may block the current Thread if f hasn't completed yet.\n
\n\n\n\n", instance_methods:{":succeeded?":{doc:"\n\n \n\n", arg:[], file:"lib/future.fy", lines:[72, 84]}, ":value":{doc:"Returns the value returned by performing self
.\nWill block the calling Thread
if self
hasn't completed or failed yet.
Registers block
as a continuation to be called with self's
fail reason in case of failure.
Registers block
as a continuation to be called with self's
value on success.
Registers block
as a continuation to be called with self's
value on success.
Forward to message initialize:receiver:message:with_params:
\n\n\n\n", arg:["@actor", "@receiver", "@message"], file:"lib/future.fy", lines:[20, 21]}, ":failure":{doc:"Returns the Exception
that caused self
to fail, or nil
, if it didn't fail.\nWill block the calling Thread
if self
hasn't completed or failed yet.
Helper class for dealing with a collection of FutureSend
s.\nImplements the Fancy
Enumerable
interface.
Calls block
with each value of each future in self
.\nRegisters block
as a continuation for each future.
Awaits all futures in self
to complete, before returning.
Structs are light-weight classes with predefined read-writable slots.
\n\n\n\n", instance_methods:{}, methods:{"new:":{doc:"Creates a new Struct class with the given slots.
\n\n \n\n", arg:["slots"], file:"lib/struct.fy", lines:[6, 25]}}, ancestors:["Struct", "Enumerable", "Object", "Kernel", "BasicObject"]}, "Fancy MessageSink":{doc:"A MessageSink just swallows all messages that are sent to it.
\n\n\n\n", instance_methods:{"unknown_message:with_params:":{doc:"m
Message sent to self
.\np
Array
of parameters sent along with m
.
Catches all messages and arguments and simply always returns self
.
Key-Value Observing Mixin class.\nInclude this Class into any class to add support for Key-Value Observing.\nInspired by Objective-C's KVO, but using Block
s, as it fits nicer\nwith Fancy's semantics.
Example:
\n\n class Person {\n include: KVO\n read_write_slots: ('name, 'age, 'city)\n }\n\n tom = Person new tap: @{\n name: \"Tom Cruise\"\n age: 55\n city: \"Hollywood\"\n }\n\n tom observe: 'name with: |new old| {\n new println\n }\n tom name: \"Tommy Cruise\" # will cause \"Tommy Cruise\" to be printed\n tom age: 56 # No observer Blocks defined, so nothing will happen\n
\n\n\n\n", instance_methods:{"observe_insertion:with:":{doc:"Registers a new insertion observer Block
for collection named slotname
in self
.
Registers a new removal observer Block
for collection named slotname
in self
.
Registers a new observer Block
for slotname
in self
.
A Fancy Documentation object is a holder for docstrings and specs.\nKeeps a registry of documentation for anything Fancy.
\n\nProvides methods for searching and formatting an Object's docstrings.\nThis can be be handy for users of the interactive Fancy REPL,\ndocument generators, instrospection tools, IDEs, anything!
\n\nThis object can be converted to just anything by using its format:\nmethod. Formatters can be registered with Fancy Documentation#formatter:is:
\n\nBy default two formatters are defined:
\n\n'fancy => Returns the Fancy::Documentation object\n 'string => Returns the docs string representation
\n\n\n\n", instance_methods:{":docs":{doc:"An array of docstrings for the object beind documented.
\n\nWe have an array of docstrings because in Fancy, some\nthings like classes can be re-openned and the user may\nspecify new documentation for it each time. Thus we dont\nwant to loose the previous documentation but rather build\nupon it. That is, fancy supports incremental documentation.
\n\n\n\n"}, "format:":{doc:"If format is specified, the documentation string will be\nconverted using the corresponding formatter. This allows\nyou to extend Fancy documentation system, and produce\nhtml documents, man pages, or anything you can imagine.
\n\n\n\n", arg:["format"], file:"lib/documentation.fy", lines:[51, 62]}, ":specs":{doc:"An array of associated Fancy specs for the object\nbeing documented.
\n\nIts a lot better to keep the associated specs in\nFancy Documentation objects instead of just having them\nin method instances. This allows us to associate any object\nwith an spec example.
\n\nThis way you can have a single Fancy spec example that\nis related to many objects (methods, constants, classes)\nthat are being specified. Later in documentation, we can\nprovide links to all specs where an object is being exercised.
\n\n\n\n"}}, methods:{"for_method:on_class:is:":{doc:"Similar to Fancy
Documentation
but taking the method name and the
Class
for which Method
to define the docstring.
Removes the documentation for obj.
\n\n\n\n", arg:["obj"], file:"lib/rbx/documentation.fy", lines:[60, 63]}, "formatter:is:":{doc:"Registers a callable object as formatter under name.
\n\n\n\n", arg:["name", "callable"], file:"lib/documentation.fy", lines:[87, 93]}, "for:is:":{doc:"Create a Fancy::Documentation instance.
\n\nNote: As we're bootstrapping, we cannot set documentation here as\nan string literal.
\n\nWe are the very first thing to load, so just create a new\nFancy::Documentation object without using new:, and set it as\nfancy docs.
\n\n\n\n", arg:["obj", "docstring"], file:"lib/rbx/documentation.fy", lines:[24, 42]}, "for:":{doc:"Obtains the Fancy Documentation for obj.
\n\n\n\n", arg:["obj"], file:"lib/rbx/documentation.fy", lines:[55, 58]}, "for:append:":{doc:"Append docstring to the documentation for obj.\nIf obj has no documentation, one is created for it.
\n\n\n\n", arg:["obj", "docstring"], file:"lib/documentation.fy", lines:[64, 77]}, "formatter:":{doc:"Obtains a formatter by a given name. Returns a callable object.
\n\n\n\n", arg:["name"], file:"lib/documentation.fy", lines:[79, 85]}, ":formatters":{doc:"Obtain the hash of known documentation formatters.
\n\n\n\n", arg:[], file:"lib/documentation.fy", lines:[95, 102]}}, ancestors:["Fancy Documentation", "Object", "Kernel", "BasicObject"]}, "OptionParser":{doc:"Parses command-line options from a given Array
(usually ARGV
) and\nexecutes registered handlers for options specified.
Creates a new OptionParser.
\n\nExample:
\n\n o = OptionParser new: @{\n with: \"--my-option\" doc: \"Sets some option value\" do: {\n # do stuff in here...\n }\n }\n o parse: ARGV # parse options from ARGV\n
\n\n \n\n", arg:["@block"], file:"lib/option_parser.fy", lines:[38, 51]}, "parse:":{doc:"Parses options from args
and executes registered option handlers.
Parses options as Hash
from args
and executes registered option handlers.
Example:
\n\n o = OptionParser new: @{\n with: \"--some-option [option_value]\" doc: \"some docstring\"\n # ...\n }\n opts = o parse_hash: [\"--some-option\", \"some-value\"]\n opts # => <[\"--some-option\" => \"some-value\"]>\n
\n\n \n\n", arg:["args"], file:"lib/option_parser.fy", lines:[103, 120]}, ":print_help_info":{doc:"Displays the --help
information on stdout
based on all options that were registered via OptionParser
with:doc:do:
.
Forward to message initialize:
\n\n\n\n", arg:[], file:"lib/option_parser.fy", lines:[23, 51]}, "with:doc:":{doc:"Forward to message with:doc:do:
\n\n\n\n", arg:["option_string", "doc_string"], file:"lib/option_parser.fy", lines:[52, 77]}, "with:doc:do:":{doc:"Example:
\n\n o = OptionParser new\n o with: \"--file [filename]\" doc: \"Use this file for processing\" do: |filename| {\n # do something with filename\n }\n
\n\n \n\n", arg:["option_string", "doc_string", "block"], file:"lib/option_parser.fy", lines:[53, 77]}}, methods:{}, ancestors:["OptionParser", "Object", "Kernel", "BasicObject"]}, "FancySpec":{doc:"The FancySpec class is used for defining FancySpec testsuites.\nHave a look at the tests/ directory to see some examples.
\n\n\n\n", instance_methods:{"initialize:":{doc:"Forward to message initialize:test_obj:
\n\n\n\n", arg:["@description"], file:"lib/fancy_spec.fy", lines:[17, 18]}, "initialize:test_obj:":{doc:"\n\n \n\n", arg:["@description", "@test_obj"], file:"lib/fancy_spec.fy", lines:[14, 18]}, "it:when:":{doc:"Example:
\n\n it: \"should be an empty Array\" when: {\n arr = [1,2,3]\n 3 times: { arr pop }\n arr empty? is: true\n }\n
\n\n \n\n", arg:["spec_info_string", "spec_block"], file:"lib/fancy_spec.fy", lines:[51, 66]}, "it:for:when:":{doc:"Example:
\n\n it: \"should be an empty Array\" with: 'empty? when: {\n arr = [1,2,3]\n 3 times: { arr pop }\n arr empty? is: true\n }\n\n # you can also pass multiple method names if the test covers more\n # than one method:\n\n it: \"tests multiple methods\" with: ['method_a, 'method_b] when: {\n # do something with method_a and method_b\n }\n
\n\n \n\n", arg:["spec_info_string", "method_names", "spec_block"], file:"lib/fancy_spec.fy", lines:[68, 104]}, "after:":{doc:"\n\n \n\n", arg:["block"], file:"lib/fancy_spec.fy", lines:[116, 122]}, "after_each:":{doc:"\n\n \n\n", arg:["block"], file:"lib/fancy_spec.fy", lines:[132, 138]}, ":run":{doc:"Runs a FancySpec's test cases.
\n\n\n\n", arg:[], file:"lib/fancy_spec.fy", lines:[140, 166]}, "it:with:when:":{doc:"Example:
\n\n it: \"should be an empty Array\" with: 'empty? when: {\n arr = [1,2,3]\n 3 times: { arr pop }\n arr empty? is: true\n }\n\n # you can also pass multiple method names if the test covers more\n # than one method:\n\n it: \"tests multiple methods\" with: ['method_a, 'method_b] when: {\n # do something with method_a and method_b\n }\n
\n\n \n\n", arg:["spec_info_string", "method_names", "spec_block"], file:"lib/fancy_spec.fy", lines:[68, 104]}, "before:":{doc:"\n\n \n\n", arg:["block"], file:"lib/fancy_spec.fy", lines:[108, 114]}, "before_each:":{doc:"\n\n \n\n", arg:["block"], file:"lib/fancy_spec.fy", lines:[124, 130]}}, methods:{"describe:with:":{doc:"Factory method for creating FancySpec instances.\nCalls block
with the new FancySpec instance as the receiver, then runs it.
Example:
\n\n FancySpec describe: MyTestClass with: {\n # test cases using it:with:when: here.\n }\n
\n\n\n\n", arg:["test_obj", "block"], file:"lib/fancy_spec.fy", lines:[20, 34]}, "describe:for:with:":{doc:"Similar to FancySpec
describe:with:
but also taking an explicit test_obj
.
Example:
\n\n FancySpec describe: \"My cool class\" for: MyCoolClass with: {\n # test cases using it:for:when: here.\n }\n
\n\n\n\n", arg:["description", "test_obj", "block"], file:"lib/fancy_spec.fy", lines:[36, 49]}}, ancestors:["FancySpec", "Object", "Kernel", "BasicObject"]}, "FancySpec SpecTest":{doc:"FancySpec test case class.
\n\n\n\n", instance_methods:{"failed:":{doc:"Forward to message failed:location:
\n\n\n\n", arg:["actual_and_expected"], file:"lib/fancy_spec.fy", lines:[274, 281]}}, methods:{"failed_test:":{doc:"Gets called when a SpecTest failed.
\n\n \n\n", arg:["test"], file:"lib/fancy_spec.fy", lines:[187, 197]}, "failed_negative_test:":{doc:"Gets called when a negative SpecTest (using NegativeMatcher
) failed.
PositiveMatcher expects its actual value to be equal to an\nexpected value.\nIf the values are not equal, a SpecTest failure is generated.
\n\n\n\n", instance_methods:{"unknown_message:with_params:":{doc:"Forwards any other message and parameters to the object itself\nand checks the return value.
\n\n\n\n", arg:["msg", "params"], file:"lib/fancy_spec.fy", lines:[377, 386]}}, methods:{}, ancestors:["FancySpec PositiveMatcher", "Object", "Kernel", "BasicObject"]}, "FancySpec NegativeMatcher":{doc:"NegativeMatcher expects its actual value to be unequal to an\nexpected value.\nIf the values are equal, a SpecTest failure is generated.
\n\n\n\n", instance_methods:{"unknown_message:with_params:":{doc:"Forwards any other message and parameters to the object itself\nand checks the return value.
\n\n\n\n", arg:["msg", "params"], file:"lib/fancy_spec.fy", lines:[429, 438]}}, methods:{}, ancestors:["FancySpec NegativeMatcher", "Object", "Kernel", "BasicObject"]}, "Fancy FDoc":{doc:"FDoc is a tool to generate API documentation from Fancy source.
\n\nWorks as follows:
\n\nFDoc will load all .fy files you give to it, and optionally run\nany specified FancySpec, and later produce documentation output.
\n\n\n\n", arg:[], file:"lib/fdoc.fy", lines:[29, 103]}}, ancestors:["Fancy FDoc", "Object", "Kernel", "BasicObject"]}, "Fancy FDoc Formatter":{doc:"A documentation formater intended to be used by FDoc
.
This formatter makes some transformations on a docstring\nand then converts it to html using markdown.
\n\n\n\n", instance_methods:{}, methods:{"create_class_references:":{doc:"Creates class references for Fancy class names.\nA docstring may contain class names sorounded by @\nwithout space between the @.
\n\nNested classes can be indicated by using :: like
\n\n Foo::Bar\n
\n\nThis will create references for both, Foo
and Bar
Instance methods should be written:
\n\n Foo::Bar#baz\n
\n\nClass methods should be written:
\n\n Foo::Bar.baz\n
\n\nSome examples:\nA simple class reference:\nFancy
Nested class reference:\nFancy
FDoc
A fancy method without arguments:\nFancy
FDoc
JSON
generate_map
A ruby method reference (will link to ruby docs if available)\nString
split
A fancy method with many arguments:\nFancy
Package
Installer
initialize:version:install_path:
A singleton method:\nFancy
FDoc
Formatter
format:
Raises a new StdError with self
as the message.
Returns the value of the constant with the given name in self
.
Sets the value of a constant with the given name in self
.
Gets called when a Class
or Module
is included into another Class
.
Calls block
with self
while having slots defined in slotnames
\nbe mutable during execution of block
.
Initializes a new Enumerator with a given collection
,\nusing #each: for iteration.
Initializes a new Enumerator with a given collection
\nand iterator
selector to be used for iteration.
Returns the next element in the collection this enumerator is attached to.\nIt will move the internal position forward (compared to e.g. #peek, which doesn't).
\n\nExample:
\n\n a = [1,2,3]\n e = a to_enum\n e next # => 1\n e next # => 2\n e next # => 3\n e next # => raises Fancy StopIteration\n
\n\n \n\n"}, "Fancy Enumerator#:ended?":{args:[], doc:"Indicates if an enumerator has ended (no more values left).
\n\n \n\n"}, "Fancy Enumerator#:peek":{args:[], doc:"Returns the next object in the Enumerator, but doesn't move the\ninternal position forward.\nWhen the position reaches the end, a Fancy StopIteration exception is\nraised.
\n\nExample:
\n\n a = [1,2,3]\n e = a to_enum\n e next p #=> 1\n e peek p #=> 2\n e peek p #=> 2\n e peek p #=> 2\n e next p #=> 2\n e next p #=> 3\n e next p #=> raises Fancy StopIteration\n
\n\n\n\n"}, "Fancy Enumerator#:rewind":{args:[], doc:"Resets the enumerator to start from the collection's beginning.
\n\n\n\n"}, "Fancy Enumerator#with:each:":{args:["object", "block"], doc:"Similar to #each: but also passing in a given object
to each invocation of block
.
Calls a given Block
with each element in the collection this enumerator is attached to.\nUsed for iterating over the collection using this enumerator.
Calls a given Block if a command-line option is in ARGV
.
Calls a given Block if any of the given command-line options are in ARGV
.
Format string as HTML using RDiscount ruby gem.
\n\n\n\n"}, "Fancy Package Handler#initialize:":{args:["@package_name"], doc:"Forward to message initialize:install_path:
\n\n\n\n"}, "Fancy Package Handler#load_fancypack:":{args:["success_block"], doc:"Forward to message load_fancypack:else:
\n\n\n\n"}, "Fancy Package Handler#load_fancypack:else:":{args:["success_block", "else_block"], doc:"Loads the @.fancypack file within the downloaded package directory.\nIf no @.fancypack file is found, raise an error.
\n\n\n\n"}, "Fancy Package Installer#initialize:":{args:["@package_name"], doc:"Forward to message initialize:version:install_path:
\n\n\n\n"}, "Fancy Package Installer#initialize:version:":{args:["@package_name", "@version"], doc:"Forward to message initialize:version:install_path:
\n\n\n\n"}, "Fancy Package Installer#initialize:version:install_path:":{args:["@package_name", "@version", "@install_path"], doc:"Creates a new Fancy
Package
installer for a given package name, an\noptional version (default is 'latest
) and an optional\ninstallation path (default is the standard installation path for\nFancy packages).
Runs the installer & installs the package into\n$FANCY_PACKAGE_DIR
.
Returns the latest tag (sorted alphabetically).
\n\n\n\n"}, "Fancy Package Installer#:tags":{args:[], doc:"\n\n \n\n"}, "Fancy Package Installer#has_version?:":{args:["version"], doc:"Indicates, if a given version for this package is available on Github.
\n\n \n\n"}, "Fancy Package Installer#download_url:":{args:["version"], doc:"Returns the download url for a given version of the package\nto be installed.
\n\n\n\n"}, "Fancy Package Installer#download_tgz:":{args:["version"], doc:"Downloads the .tar.gz file from Github with the given version\n(tag or branch name) and saves it to the specified install_path
.
The Default install_path is ~/.fancy/packages/.\nIf an environment variable FANCY_PACKAGE_DIR
is defined, it\nwill get used.
Unpacks the given filename
and installs it into Fancy's package install dir.
Renames a given directory to a common way within the install path.\n=> It will rename the given dirname to $user/$repo-$version.
\n\n\n\n"}, "Fancy Package Installer#fulfill_spec:":{args:["spec"], doc:"Installs all dependencies of spec
, sets up symlinks for binary files in spec
,\nas well as installing the include-file into the Fancy package lib dir.
Forward to message initialize:version:
\n\n\n\n"}, "Fancy Package Dependency#:install":{args:[], doc:"Installs the Dependency on the System.
\n\n\n\n"}, "Fancy Package RubyDependency#initialize:":{args:["@gem_name"], doc:"Forward to message initialize:version:
\n\n\n\n"}, "Fancy Package RubyDependency#:install":{args:[], doc:"Installs the RubyDependency (a RubyGem) via rbx -S gem on the system.
\n\n\n\n"}, "Fancy Package Specification#add_dependency:":{args:["name"], doc:"Forward to message add_dependency:version:
\n\n\n\n"}, "Fancy Package Specification#add_ruby_dependency:":{args:["gem_name"], doc:"Forward to message add_ruby_dependency:version:
\n\n\n\n"}, "Fancy Package#install:":{args:["package_name"], doc:"Forward to message install:version:
\n\n\n\n"}, "Fancy Package#install:version:":{args:["package_name", "version"], doc:"Installs a package with a given name.\nExpects package_name to be a string in the form of:\n user/repo\nWhich would get the package code from github.com/user/repo
\n\n \n\n"}, "Fancy Package#:install_dependencies":{args:[], doc:"Installs dependencies found in .fancypack file in the current directory.\nIf no .fancypack file is found, fails and quits.
\n\n\n\n"}, "Fancy Package#uninstall:":{args:["package_name"], doc:"Uninstalls a package with a given name (if installed).
\n\n \n\n"}, "Fancy Package#:list_packages":{args:[], doc:"Lists (prints) all installed packages on this system.
\n\n\n\n"}, "Fancy Package#:root_dir":{args:[], doc:"\n\n \n\n"}, "Fancy Package#:package_list_file":{args:[], doc:"\n\n \n\n"}, "Fancy Package#:add_to_loadpath":{args:[], doc:"Adds the Fancy Package install dir to the loadpath so you can\neasily require:
packages into your code.
Forward to message write:call:
\n\n\n\n"}}, objects:{}}); })();