Sha256: 38ff96049b8412955a9a2892580c3ee07b548b4b6d8f6d3839094aa9c42ec043

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

class Symbol {
  def eval {
    binding = Binding setup(Rubinius VariableScope of_sender(),
                            Rubinius CompiledMethod of_sender(),
                            Rubinius StaticScope of_sender())
    Fancy eval: to_s binding: binding
  }

  def inspect {
    "'" ++ to_s
  }

  def defined? {
    """
    @return @true, if @self is defined as a constant in senders scope, @false otherwise.

    Indicates if a Symbol is defined as a constant in the senders scope.
    """

    binding = Binding setup(Rubinius VariableScope of_sender(),
                            Rubinius CompiledMethod of_sender(),
                            Rubinius StaticScope of_sender())

    binding send('self) class const_defined?(self)
  }

  def message_name {
    symbol = self to_s
    val = symbol include?(":")
    match val {
      case true -> symbol to_sym
      case false -> ":" <<(symbol) to_sym
    }
  }

  def to_fancy_message {
    to_s to_fancy_message to_sym
  }

  def =~ regexp {
    to_s =~ regexp
  }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fancy-0.10.0 lib/rbx/symbol.fy