lib/true_class.fy in fancy-0.3.3 vs lib/true_class.fy in fancy-0.4.0
- old
+ new
@@ -1,39 +1,77 @@
class TrueClass {
- "TrueClass. The class of the singleton @true value."
+ """
+ TrueClass. The class of the singleton @true value.
+ """
def TrueClass new {
+ """
+ @return @true.
+ """
+
# always return true singleton object when trying to create a new
# TrueClass instance
true
}
def if_true: block {
- "Calls @block."
+ """
+ @block @Block@ to be called with @self.
+ @return Value of calling @block with @self.
+
+ Calls @block with @self.
+ """
+
block call: [self]
}
def if_true: then_block else: else_block {
- "Calls @then_block."
+ """
+ @then_block @Block@ to be called with @self.
+ @else_block Gets ignored.
+ @return Value of calling @then_block with @self.
+
+ Calls @then_block with @self.
+ """
+
then_block call: [self]
}
def true? {
- "Returns @true."
+ """
+ @return @true.
+ """
+
true
}
def to_s {
- "Returns @true as a @String@."
+ """
+ @return @true as a @String@.
+ """
+
"true"
}
+ alias_method: 'inspect for: 'to_s
+
def to_a {
- "Returns an empty @Array@."
+ """
+ @return An empty @Array@.
+ """
+
[]
}
def not {
- "Returns @false."
+ """
+ @return @false.
+ """
+
false
}
}
+
+true documentation: """
+ @true is the singleton boolean true value (only instance of @TrueClass@).
+ TrueClass##new yields @true.
+ """