module Fuby

Constants

Enumerables
TOK_ARITY
TOK_PARITY

Public Instance Methods

%(format) click to toggle source
# File lib/fuby/format.rb, line 4
def % format
  (to_s % format).to_sym
end
&(that) click to toggle source
# File lib/fuby/and.rb, line 4
def & that
  dup.reject { |key| ! that.has_key? key }
end
+(that) click to toggle source
# File lib/fuby/plus.rb, line 4
def + that
  that = that.source if Regexp === that
  self.class.new source + that.source, options
end
__random__(n = 64) click to toggle source
# File lib/fuby/random.rb, line 24
def __random__ n = 64
  :"__%s__" % ::String.random(n)
end
__uuid() click to toggle source
# File lib/fuby/uuid.rb, line 19
def __uuid
  :"__%s" % ::String.uuid
end
__uuid__() click to toggle source
# File lib/fuby/uuid.rb, line 23
def __uuid__
  :"__%s__" % ::String.uuid
end
abbreviation=(sym) click to toggle source
# File lib/fuby/abbreviation.rb, line 9
def abbreviation= sym
  raise ArgumentError, "`abbreviation` of a Symbol must be a Symbol, found #{ sym.class }: #{ sym }" unless Symbol === sym
  raise ArgumentError, "`abbreviation` of :#{ self } already :#{ abbreviation }, found #{ sym }" unless @abbreviation.nil? || @abbreviation == sym
  return if @abbreviation == sym
  @abbreviation = sym
  sym.instance_variable_set :@unabbreviation, self
end
alias_method(*sig) click to toggle source
# File lib/fuby/alias_method.rb, line 7
def alias_method *sig
  case sig.length
  when 1
    sig.unshift new_name = Symbol.__uuid__
    self.send :alias_method, *sig
    new_name
  when 2
    self.send :alias_method, *sig
  else raise new TypeError
  end
end
alias_singleton_method(*sig) click to toggle source
# File lib/fuby/alias_singleton_method.rb, line 7
def alias_singleton_method *sig
  case sig.length
  when 1
    sig.unshift new_name = Symbol.__uuid__
    self.singleton_class.send :alias_method, *sig
    new_name
  when 2
    self.singleton_class.send :alias_method, *sig
  else raise new TypeError
  end
end
ancestors(type = nil) click to toggle source
Calls superclass method
# File lib/fuby/ancestors.rb, line 4
def ancestors type = nil
  super().tap { |mods| return mods.select { |mod| type === mod } if type }
end
bind(receiver) click to toggle source
# File lib/fuby/bind.rb, line 6
def bind receiver # pinched from facets#lib/core/facets/proc/bind.rb
  block = self
  anonymous_name = Symbol.__uuid__
  
  receiver.singleton_class.class_eval do
    define_method anonymous_name, &block
    anonymous_method = instance_method anonymous_name
    remove_method anonymous_name
    anonymous_method
  end.bind receiver
end
cardinality() click to toggle source
# File lib/fuby/cardinality.rb, line 6
def cardinality
  1
end
curry_eval(*pre, &shell) click to toggle source
# File lib/fuby/curry_eval.rb, line 6
def curry_eval *pre, &shell

  if Hash === pre.last
    defaults = pre.pop
    intercept { |*sig, &blk| send *pre, sig, (sig.pop_options defaults), &blk }

  else
    intercept { |*sig, &blk| send *pre, &blk }

  end.instance_exec self, &shell
end
deep_const_get(*names) click to toggle source
# File lib/fuby/deep_const_get.rb, line 4
def deep_const_get *names
  if 1 == names.length
    name  = names.first
    names = name.scan /[^:]+/ if /[:]+/ === name
  end
  names.inject(self) { |mod, name| mod.const_get name }
end
deep_each(*path) { |e, i, *path| ... } click to toggle source
# File lib/fuby/deep_each.rb, line 8
def deep_each *path, &blk
  if block_given?

    each_with_index_or_key do |e, i|
      next e.deep_each i, *path, &blk if self.class === e
      next yield e, i, *path
    end

  else

    ::Enumerator.new do |result|
      deep_each { |e, *path| result.<< e, *path }
    end

  end
end
define_instance_method(*sig, &blk) click to toggle source
# File lib/fuby/define_instance_method.rb, line 4
def define_instance_method *sig, &blk
  self.send :define_method, *sig, &blk
end
define_missing_method(missing_reg, &missing_blk) click to toggle source
Calls superclass method
# File lib/fuby/define_missing_method.rb, line 9
def define_missing_method missing_reg, &missing_blk
  send :define_method, missing_method = Symbol.__uuid__, &missing_blk
  prepend {
    mod = self
    mod.send.define_method(:method_missing) { |key, *sig, &blk|
      return super key, *sig, &blk unless matched_sig = missing_reg.match(key)
      matched_sig = matched_sig.to_a.drop 1
      mod.send.define_method(key) { |*sig, &blk| send missing_method, *(matched_sig + sig), &blk }
      send key, *sig, &blk
    }
    mod.send.define_method(:respond_to?) { |key| missing_reg === key || super(key) }
  }
end
define_object_method(*sig, &blk) click to toggle source
# File lib/fuby/define_object_method.rb, line 4
def define_object_method *sig, &blk
  self.send :define_singleton_method, *sig, &blk
end
define_tok(name, toker) click to toggle source
# File lib/fuby/define_tok.rb, line 6
def define_tok name, toker
  define_method name, &toker.to_tok 
end
descendants(type = ::Module) click to toggle source
# File lib/fuby/descendants.rb, line 4
def descendants type = ::Module
  ObjectSpace.each_object(type).select { |mod| mod < self }
end
drop(i = 1) click to toggle source
Calls superclass method
# File lib/fuby/drop.rb, line 4
def drop i = 1
  return []    if empty?
  return super if i >= 0
  return super i % length
end
drop!(i = 1) click to toggle source
# File lib/fuby/drop.rb, line 10
def drop! i = 1
  shift i
  self
end
drop_until(&blk) click to toggle source
# File lib/fuby/drop_until.rb, line 6
def drop_until &blk
  drop_while &blk.not
end
drop_until!(&blk) click to toggle source
# File lib/fuby/drop_until.rb, line 10
def drop_until! &blk
  drop_while! &blk.not
end
drop_while!(&blk) click to toggle source
# File lib/fuby/drop_while.rb, line 6
def drop_while! &blk
  shift_while &blk
  self
end
each_with_index_or_key() { |val, key| ... } click to toggle source
# File lib/fuby/each_with_index_or_key.rb, line 4
def each_with_index_or_key
  return each { |key, val| yield val, key } if block_given?
  return ::Enumerator.new { |result| each { |key, val| result.<< val, key } }
end
eastern_name() click to toggle source
# File lib/fuby/eastern_name.rb, line 6
def eastern_name
  names.join ' '
end
eql_componentwise?(that) click to toggle source
# File lib/fuby/eql_componentwise.rb, line 8
def eql_componentwise? that
  each_with_index_or_key.all? { |e, k| e == that[k] }
end
equivalence?(eq = :eql?) click to toggle source
# File lib/fuby/equivalence.rb, line 8
def equivalence? eq = :eql?
  each_cons(2).splat.all? { |fst, snd| fst.send eq, snd }
end
extend(*extends, &body) click to toggle source
# File lib/fuby/extend.rb, line 6
def extend *extends, &body
  self.send :extend, *extends unless extends.empty?
  self.send :extend, ::Module.new(&body) if block_given?
  self
end
first=(it) click to toggle source
# File lib/fuby/first.rb, line 4
def first= it
  self[0] = it
end
hash_eval(&body) click to toggle source
# File lib/fuby/hash_eval.rb, line 6
def hash_eval &body
  intercept do |key, *sig, &blk|
    val = self[key]
    key = key.to_s.chomp!("!").to_sym and self.delete key if /!$/ === key.to_s

    case sig
    when [] then sig.unshift ({}) if blk
    when [Object]
    else raise ::ArgumentError
    end

    case arg = sig.first
    when nil then next val
    when ::Hash
      self[key] = {} if self[key].nil?
      self[key].merge! arg
      self[key].hash_exec &blk if blk
    else
      self[key] = arg
    end

    self[key]
  end.instance_exec &body
end
include(*includes, &body) click to toggle source
# File lib/fuby/include.rb, line 6
def include *includes, &body
  self.send :include, *includes unless includes.empty?
  self.send :include, ::Module.new(&body) if block_given?
  self
end
index_or_key() click to toggle source
# File lib/fuby/index_or_key.rb, line 4
def index_or_key
  index
end
intercept(&intercept) click to toggle source
# File lib/fuby/intercept.rb, line 10
def intercept &intercept
  Intercept.new self, &intercept
end
invert() click to toggle source
# File lib/fuby/invert.rb, line 11
def invert
  to_hash.invert
end
last=(it) click to toggle source
# File lib/fuby/last.rb, line 4
def last= it
  self[length - 1] = it
end
longest_common_prefix(*those) click to toggle source
# File lib/fuby/longest_common_prefix.rb, line 6
def longest_common_prefix *those
  zip(*those).take_while(:equivalence?).map(:first)
end
longest_common_suffix(*those) click to toggle source
# File lib/fuby/longest_common_suffix.rb, line 6
def longest_common_suffix *those
  zip(*those).map(&:reverse).take_while(:equivalence?).map(:first).map(&:reverse)
end
matches?(that) click to toggle source
# File lib/fuby/matches.rb, line 9
def matches? that
  count == that.count and matches_componentwise? that
end
matches_componentwise?(that) click to toggle source
# File lib/fuby/matches_componentwise.rb, line 10
def matches_componentwise? that
  each_with_index_or_key.all? { |e, k| e === that[k] }
end
matches_part_of?(that) click to toggle source
# File lib/fuby/matches_part_of.rb, line 10
def matches_part_of? that
  count <= that.count and matches_componentwise? that
end
matches_prefix_of?(*sig, &blk) click to toggle source
# File lib/fuby/matches_prefix_of.rb, line 9
def matches_prefix_of? *sig, &blk
  matches_part_of? *sig, &blk
end
matches_suffix_of?(that) click to toggle source
# File lib/fuby/matches_suffix_of.rb, line 7
def matches_suffix_of? that
  matches? that.drop - length
end
merge_css(that) click to toggle source
# File lib/fuby/merge_css.rb, line 4
def merge_css that
  dup.merge_css! that
end
merge_css!(that) click to toggle source
# File lib/fuby/merge_css.rb, line 8
def merge_css! that
  merge! that do |key, lft, rgt|
    case key
    when /^class$/ then "#{ lft } #{ rgt }"
    when /^style$/ then "#{ lft };#{ rgt }"
    else rgt
    end
  end
end
method_added_as_binary_operator(*names) click to toggle source
Calls superclass method
# File lib/fuby/method_added_as_binary_operator.rb, line 6
def method_added_as_binary_operator *names
  names.each do |name|
    prepend do
      define_method name do |*sig|
        return method name if sig.empty?
        return super *sig
      end
    end
  end
end
method_added_as_filter(*names) click to toggle source
Calls superclass method
# File lib/fuby/method_added_as_filter.rb, line 7
def method_added_as_filter *names
  names.each do |name|
    prepend do
      define_method name do |match = nil, &pred|
        return method name if match.nil? && pred.nil?
        return super &(pred || match.to_pred)
      end
    end
  end
end
names() click to toggle source
# File lib/fuby/names.rb, line 4
def names
  name.split '::'
end
new() click to toggle source
# File lib/fuby/new.rb, line 4
def new
  0.0
end
not() click to toggle source
# File lib/fuby/not.rb, line 4
def not
  proc { |*sig, &blk| ! call *sig, &blk }
end
opposite=(sym) click to toggle source
# File lib/fuby/opposite.rb, line 7
def opposite= sym
  raise ::ArgumentError, "`opposite` of a Symbol must be a Symbol, found #{ sym.class }: #{ sym }" unless ::Symbol === sym
  raise ::ArgumentError, "`opposite` of :#{ self } already :#{ opposite }, found: #{ sym }" unless @opposite.nil? || @opposite == sym
  return if @opposite == sym
  @opposite = sym and sym.opposite = self
end
otherwise(that = nil) click to toggle source
# File lib/fuby/otherwise.rb, line 4
def otherwise that = nil
  self
end
outer_module() click to toggle source
# File lib/fuby/outer_module.rb, line 6
def outer_module
  @outer_module ||= /::[^:]+\Z/ === self ? Kernel.deep_const_get($`) : Kernel
end
pop(i = nil) click to toggle source
Calls superclass method
# File lib/fuby/pop.rb, line 4
def pop i = nil
  return super() unless i
  return super(i % length) unless empty?
end
pop_if() { |first| ... } click to toggle source
# File lib/fuby/pop_if.rb, line 6
def pop_if &blk
  pop if yield first
end
pop_options(*defaults) click to toggle source
# File lib/fuby/pop_options.rb, line 4
def pop_options *defaults
  defaults.each_with_object (Hash === last ? pop : {}) do |dft, opt|
    opt.merge!(dft) { |key, val| val }
  end
end
pop_unless() { |first| ... } click to toggle source
# File lib/fuby/pop_unless.rb, line 4
def pop_unless &blk
  pop unless yield first
end
pop_until(&blk) click to toggle source
# File lib/fuby/pop_until.rb, line 4
def pop_until &blk
  pop count - (rindex &blk)
end
pop_while(&blk) click to toggle source
# File lib/fuby/pop_while.rb, line 4
def pop_while &blk
  pop_until &(blk.not)
end
prefix_of?(*sig, &blk) click to toggle source
# File lib/fuby/prefix_of.rb, line 6
def prefix_of? *sig, &blk
  part_of? *sig, &blk
end
prefixes() click to toggle source
# File lib/fuby/prefixes.rb, line 4
def prefixes
  length.downto(1).map &(method :take)
end
prepend(*includes, &body) click to toggle source
# File lib/fuby/prepend.rb, line 4
def prepend *includes, &body
  self.send :prepend, *includes unless includes.empty?
  self.send :prepend, ::Module.new(&body) if block_given?
  self
end
private?(inherited = true) click to toggle source
# File lib/fuby/private.rb, line 4
def private? inherited = true
  owner.private_instance_methods(inherited).include? name
end
protected?(inherited = true) click to toggle source
# File lib/fuby/protected.rb, line 4
def protected? inherited = true
  owner.protected_instance_methods(inherited).include? name
end
public?(inherited = true) click to toggle source
# File lib/fuby/public.rb, line 4
def public? inherited = true
  owner.public_instance_methods(inherited).include? name
end
push_options(*defaults) click to toggle source
# File lib/fuby/pop_options.rb, line 10
def push_options *defaults
  pop_options(*defaults).tap { |opt| push opt }
end
random() click to toggle source
# File lib/fuby/random.rb, line 6
def random
  min + ::SecureRandom.random_number(max - min)
end
reject() click to toggle source
Calls superclass method
# File lib/fuby/reject.rb, line 8
def reject
  super
end
reject!() click to toggle source
Calls superclass method
# File lib/fuby/reject.rb, line 12
def reject!
  super
end
select() click to toggle source
Calls superclass method
# File lib/fuby/select.rb, line 8
def select
  super
end
select!() click to toggle source
Calls superclass method
# File lib/fuby/select.rb, line 12
def select!
  super
end
self_and_descendants(type = ::Module) click to toggle source
# File lib/fuby/self_and_descendants.rb, line 6
def self_and_descendants type = ::Module
  ObjectSpace.each_object(type).select { |mod| mod <= self }
end
send(*sig) { |send self| ... } click to toggle source
Calls superclass method
# File lib/fuby/send.rb, line 4
def send *sig, &blk
  return super unless sig.empty?
  return yield Send.new self if block_given?
  return Send.new self
end
shift(i = nil) click to toggle source
Calls superclass method
# File lib/fuby/shift.rb, line 4
def shift i = nil
  return super() unless i
  return super(i % length) unless empty?
end
shift_if() { |first| ... } click to toggle source
# File lib/fuby/shift_if.rb, line 6
def shift_if
  shift if yield first
end
shift_options(*defaults) click to toggle source
# File lib/fuby/shift_options.rb, line 4
def shift_options *defaults
  defaults.each_with_object Hash === first ? shift : {} do |default, opt|
    opt.merge!(default) { |key, preexisting| preexisting }
  end
end
shift_unless() { |first| ... } click to toggle source
# File lib/fuby/shift_unless.rb, line 6
def shift_unless
  shift unless yield first
end
shift_until(&blk) click to toggle source
# File lib/fuby/shift_until.rb, line 6
def shift_until &blk
  shift index(&blk)
end
shift_while(&blk) click to toggle source
# File lib/fuby/shift_while.rb, line 8
def shift_while &blk
  shift_until &(blk.not)
end
singleton_method_defined?(name) click to toggle source
# File lib/fuby/singleton_method_defined.rb, line 4
def singleton_method_defined? name
  singleton_class.send :method_defined?, name
end
strip(pattern = nil) click to toggle source
Calls superclass method
# File lib/fuby/strip.rb, line 6
def strip pattern = nil
  return super unless ::RegExp === pattern
  strip_beginning(pattern).strip_ending(pattern)
end
strip_beginning(pattern) click to toggle source
# File lib/fuby/strip.rb, line 11
def strip_beginning pattern
  pattern = /^/ + pattern unless /^\^/ === pattern.source
  sub pattern, ''
end
strip_ending(pattern) click to toggle source
# File lib/fuby/strip.rb, line 16
def strip_ending pattern
  pattern = pattern + /$/ unless /\$$/ === pattern.source
  sub pattern, ''
end
subclass(*sig, &blk) click to toggle source
Calls superclass method
# File lib/fuby/subclass.rb, line 6
def subclass *sig, &blk
  case self
  
  when Class
    Class.new self
  
  when Module
    Class.new.send.include self
  
  else super
  end.send.include *sig, &blk
end
submodule(*sig, &blk) click to toggle source
Calls superclass method
# File lib/fuby/submodule.rb, line 6
def submodule *sig, &blk
  case self
  
  when Class
    Class.new self
  
  when Module
    Module.new.send.include self
  
  else super
  end.send.include *sig, &blk
end
suffix_of?(that) click to toggle source
# File lib/fuby/suffix_of.rb, line 4
def suffix_of? that
  eql? that.drop -length
end
suffixes() click to toggle source
# File lib/fuby/suffixes.rb, line 4
def suffixes
  (0 .. length - 1).map &(method :drop)
end
take(i = 1) click to toggle source
Calls superclass method
# File lib/fuby/take.rb, line 4
def take i = 1
  return []    if empty?
  return super if i >= 0
  return super i % length
end
take!(i = 1) click to toggle source
# File lib/fuby/take.rb, line 10
def take! i = 1
  pop length - i % length
  self
end
take_until(&blk) click to toggle source
# File lib/fuby/take_until.rb, line 9
def take_until &blk
  take_while &(blk.not)
end
take_until!(&blk) click to toggle source
# File lib/fuby/take_until.rb, line 13
def take_until! &blk
  take_while! &blk.not
end
take_while() click to toggle source
Calls superclass method
# File lib/fuby/take_while.rb, line 8
def take_while
  super
end
take_while!(&blk) click to toggle source
# File lib/fuby/take_while.rb, line 12
def take_while! &blk
  pop length - index(&blk)
  self
end
tap(&blk) click to toggle source
Calls superclass method
# File lib/fuby/tap.rb, line 4
def tap &blk
  return super if block_given?
  return self
end
tap!() click to toggle source
# File lib/fuby/tap.rb, line 19
def tap!
  raise ::TypeError
end
tap?() click to toggle source
# File lib/fuby/tap.rb, line 15
def tap?
  self
end
to_CamelCase() click to toggle source
# File lib/fuby/to_camel_case.rb, line 14
def to_CamelCase
  to_components.map { |str| str.sub /[A-z0-9]/, &:upcase }.join
end
to_DASH_CASE() click to toggle source
# File lib/fuby/to_dash_case.rb, line 6
def to_DASH_CASE
  to_components.join('-').upcase
end
to_DOT_CASE() click to toggle source
# File lib/fuby/to_dot_case.rb, line 6
def to_DOT_CASE
  to_components.join('.').upcase
end
to_SLASH_CASE() click to toggle source
# File lib/fuby/to_slash_case.rb, line 6
def to_SLASH_CASE
  to_components.join('/').upcase
end
to_SNAKE_CASE() click to toggle source
# File lib/fuby/to_snake_case.rb, line 10
def to_SNAKE_CASE
  to_components.join('_').upcase
end
to_boolean() click to toggle source
# File lib/fuby/to_boolean.rb, line 4
def to_boolean
  self > 0
end
to_camelCase() click to toggle source
# File lib/fuby/to_camel_case.rb, line 6
def to_camelCase
  components = to_components
  first      = components.shift.downcase
  components.map! { |str| str.sub /[A-z0-9]/, &:upcase }
  components.unshift first
  components.join
end
to_components() click to toggle source
# File lib/fuby/to_components.rb, line 4
def to_components
  return downcase.to_components if /[A-Z]/ === self unless /[a-z]/ === self # it's all CAPS
  scan /[A-Z]+[0-9]*(?=_|\b|[^A-z]|[A-Z][a-z])|[A-Z]?[a-z]+[0-9]*(?=_|\b|[^a-z]|[A-Z])|[0-9]+[a-z]*/
  #
  # presuming either some form of camelCase or lower_case, either:
  #
  # a run of capitals optionally followed by an integer, excluding the capital leading a following CamelCase word
  # e.g. HTML5, IE9
  #
  # a run of lower-case letters optionally followed by an integer
  # e.g. html5, ie9
  #
  # a number or number word
  # e.g. 1st, 2nd
  #
  # a proper camelCase component
end
to_dash_case() click to toggle source
# File lib/fuby/to_dash_case.rb, line 10
def to_dash_case
  to_components.join('-').downcase
end
to_dot_case() click to toggle source
# File lib/fuby/to_dot_case.rb, line 10
def to_dot_case
  to_components.join('.').downcase
end
to_hash() click to toggle source
# File lib/fuby/to_hash.rb, line 11
def to_hash
  {}.tap { |hash| each_with_index_or_key { |val, key| hash[key] = val } }
end
to_proc() click to toggle source
# File lib/fuby/to_proc.rb, line 4
def to_proc
  proc &method(:[])
end
to_regexp() click to toggle source
# File lib/fuby/to_regexp.rb, line 4
def to_regexp
  dup
end
to_slash_case() click to toggle source
# File lib/fuby/to_slash_case.rb, line 10
def to_slash_case
  to_components.join('/').downcase
end
to_snake_case() click to toggle source
# File lib/fuby/to_snake_case.rb, line 6
def to_snake_case
  to_components.join('_').downcase
end
to_tok() click to toggle source
# File lib/fuby/to_tok.rb, line 12
def to_tok
  invert.to_proc
end
tok_arity() click to toggle source
# File lib/fuby/tok_arity.rb, line 4
def tok_arity
  arity.tok_arity
end
tok_parity() click to toggle source
# File lib/fuby/tok_parity.rb, line 6
def tok_parity
  TOK_PARITY[ self % 2 ]
end
try(*sig) { |many self| ... } click to toggle source
# File lib/fuby/try.rb, line 4
def try *sig, &blk
  if sig.empty?
    if block_given?
      result = yield Try::Many.new self
      return result.__unwrap__ if Try::Base === result
      return result
    end
    return Try::Once.new self
  else
    return send *sig, &blk if respond_to? sig.first 
    return nil
  end
end
try?(*sig) { |many self, self| ... } click to toggle source
# File lib/fuby/try.rb, line 18
def try? *sig, &blk
  if sig.empty?
    if block_given?
      result = yield Try::Many.new self, self
      return result.__unwrap__ if Try::Base === result
      return result
    end
    return Try::Once.new self, self
  else
    return send *sig, &blk if respond_to? sig.first 
    return self
  end
end
try_each(*sig, &blk) click to toggle source
# File lib/fuby/try_each.rb, line 8
def try_each *sig, &blk
  return Try::Each.new self if sig.empty? && !blk
  return each { |arg| arg.try *sig, &blk }
end
try_eval(&blk) click to toggle source
# File lib/fuby/try_eval.rb, line 8
def try_eval &blk
  result = (Try::Many.new self).instance_eval &blk
  return result.__unwrap__ if Try::Base === result
  return result
end
try_eval?(&blk) click to toggle source
# File lib/fuby/try_eval.rb, line 14
def try_eval? &blk
  result = (Try::Many.new self, self).instance_eval &blk
  return result.__unwrap__ if Try::Base === result
  return result
end
unabbreviation=(sym) click to toggle source
# File lib/fuby/unabbreviation.rb, line 9
def unabbreviation= sym
  raise ArgumentError, "`unabbreviation` of a Symbol must be a Symbol, found #{ sym.class }: #{ sym }" unless Symbol === sym
  raise ArgumentError, "`unabbreviation` of :#{ self } already :#{ unabbreviation }, found #{ sym }" unless @unabbreviation.nil? || @unabbreviation == sym
  return if @unabbreviation == sym
  @unabbreviation = sym and sym.abbreviation = self
end
unshift_options(*defaults) click to toggle source
# File lib/fuby/unshift_options.rb, line 8
def unshift_options *defaults
  shift_options(*defaults).tap { |opt| push opt }
end
uuid() click to toggle source
# File lib/fuby/uuid.rb, line 8
def uuid
  ::SecureRandom.uuid.gsub '-', '_'
end
western_name() click to toggle source
# File lib/fuby/western_name.rb, line 6
def western_name
  names.reverse.join ' '
end
|(that) click to toggle source
# File lib/fuby/or.rb, line 4
def | that
  dup.merge(that) { |key, src, dst| src }
end