Sha256: 74b5cab9b47946f842becf297f568cc9c61ae15330ccb5d8a6d44ea82b4b4cff

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

class Class {
  def alias_method: new for: old {
    alias_method(new, old)
  }

  def ruby_alias: method_name {
    alias_method(":" + (method_name to_s), method_name)
  }
}

class String {
  alias_method: ":+" for: "+"
}

class Object {

  ruby_alias: '==
  ruby_alias: '===
  ruby_alias: 'class
  ruby_alias: 'inspect

  def initialize {
    initialize()
  }

  def dclone {
    "Returns a deep clone of self using Ruby's Marshal class."
    Marshal load(Marshal dump(self))
  }

  def to_s {
    to_s()
  }

  def set_slot: slotname value: val {
    instance_variable_set("@" ++ slotname, val)
  }

  def get_slot: slotname {
    instance_variable_get("@" ++ slotname)
  }

  def define_singleton_method: name with: block {
    metaclass define_method: name with: block
  }

  def undefine_singleton_method: name {
    metaclass undefine_method: name
  }

  def is_a?: class {
    "Indicates, if an object is an instance of a given Class."
    is_a?(class)
  }

  def kind_of?: class {
    "Indicates, if an object is an instance of a given Class."
    kind_of?(class)
  }

  def send_message: message {
    send(message_name: message)
  }

  def send_message: message with_params: params {
    ruby: (message_name: message) args: params
  }

  def message_name: symbol {
    symbol = symbol to_s
    if: (symbol =~ /:/) then: {
      symbol
    } else: {
      ":" ++ symbol
    }
  }

  def responds_to?: message {
    respond_to?(message_name: message)
  }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fancy-0.3.3 lib/rbx/object.fy