module GodObject::FilePermissions::ModeMixin::ClassMethods

Class mixin for Mode and SpecialMode

Public Instance Methods

build(mode) click to toggle source

Either passes through or generates a new Mode object

@return [GodObject::FilePermissions::ModeMixin]

@overload build(mode)

@param [GodObject::FilePermissions::ModeMixin] mode an already
  existing Mode

@overload build(string)

@param [String] string a String representation

@overload build(numeric)

@param [Integer] numeric a numeric representation

@overload build(enabled_digits)

@param [Array<Symbol>] enabled_digits a list of enabled digits
# File lib/god_object/file_permissions/mode_mixin.rb, line 51
def build(mode)
  case
  when mode.kind_of?(self)
    mode
  when mode.respond_to?(:to_str)
    parse(mode)
  else
    new(mode)
  end
end