Class: Symbol

Inherits:
Object show all
Defined in:
lib/amp/support/support.rb

Instance Method Summary collapse

Instance Method Details

#to_hg_intObject

Converts the symbol to an integer used for tracking the state of files in the dir_state.



885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
# File 'lib/amp/support/support.rb', line 885

def to_hg_int
  case self
  when :normal, :dirty
    110 # "n".ord
  when :untracked
    63 # "?".ord
  when :added
    97 # "a".ord
  when :removed
    114 # "r".ord
  when :merged
    109 # "m".ord
  else
    raise "No known hg value for #{self}"
  end
end

#to_hg_letterObject

Converts the symbol to the letter it corresponds to



903
904
905
# File 'lib/amp/support/support.rb', line 903

def to_hg_letter
  to_hg_int.chr
end

#to_procObject



907
908
909
910
911
# File 'lib/amp/support/support.rb', line 907

def to_proc
  proc do |arg|
    arg.send self
  end
end