Sha256: b998ff7a1875ea83a5b5ec85abe48be402838a6e0968d8c9179ac0abab3eb82f

Contents?: true

Size: 1.75 KB

Versions: 2

Compression:

Stored size: 1.75 KB

Contents

class MethodMixin {
  """
  Mixin class with common methods included by @Method@ and @UnboundMethod@.
  """

  def documentation {
    """
    @return Docstring for @self.
    """

    Fancy Documentation for: executable
  }

  def documentation: docstring {
    """
    @docstring New docstring for @self.
    """

    Fancy Documentation for: executable is: docstring
  }

  def visibility {
    """
    @return The visibility (@'private, @'protected, @'public) of a @Method@ in its defined context, if any.
    """
    entry = @defined_in method_table() lookup(@name)
    { entry visibility() } if: entry
  }

  def public? {
    """
    @return @true, if the @Method@ is public in its defined context.
    """
    visibility == 'public
  }

  def protected? {
    """
    @return @true, if the @Method@ is protected in its defined context.
    """
    visibility == 'protected
  }

  def private? {
    """
    @return @true, if the @Method@ is private in its defined context.
    """
    visibility == 'private
  }

  def tests {
    """
    Returns an Array of all the FancySpec SpecTests defined for a
    Method.
    """

    @__method_tests__ =  @__method_tests__ || []
    @__method_tests__
  }

  def test: test_block {
    it = FancySpec new: self
    test_block call: [it]
    tests << it
  }
}

class Method {
  """
  An instance of Method represents a method on a Class.
  Every method in Fancy is an instance of the Method class.
  """

  ruby_alias: 'arity
  ruby_alias: 'executable
  include: MethodMixin
  forwards_unary_ruby_methods
}

class UnboundMethod {
  """
  An instance UnboundMethod represents a Method object not bound to a specific @Class@ or @Object@.
  """

  ruby_alias: 'arity
  ruby_alias: 'executable
  include: MethodMixin
  forwards_unary_ruby_methods
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fancy-0.7.0 lib/rbx/method.fy
fancy-0.6.0 lib/rbx/method.fy