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.



934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
# File 'lib/amp/support/support.rb', line 934

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



952
953
954
# File 'lib/amp/support/support.rb', line 952

def to_hg_letter
  to_hg_int.chr
end

#to_procObject



956
957
958
959
960
# File 'lib/amp/support/support.rb', line 956

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