Class: Gity::StatusList

Inherits:
Object
  • Object
show all
Includes:
TR::CondUtils
Defined in:
lib/gity/status_list.rb

Instance Method Summary collapse

Constructor Details

#initialize(list) ⇒ StatusList

Returns a new instance of StatusList.



7
8
9
# File 'lib/gity/status_list.rb', line 7

def initialize(list)
  @list = list || {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(mtd, *args, &block) ⇒ Object



31
32
33
34
35
# File 'lib/gity/status_list.rb', line 31

def method_missing(mtd, *args, &block)
  if [:modified, :new, :deleted, :staged].include?(mtd)
    @list[mtd.to_sym]
  end
end

Instance Method Details

#clean?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/gity/status_list.rb', line 27

def clean?
  not has_modified? and not has_new? and not has_deleted? and not has_staged?
end

#has_deleted?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/gity/status_list.rb', line 19

def has_deleted?
  @list[:deleted].nil? ? false : (not_empty?(@list[:deleted][:files]) or not_empty?(@list[:deleted][:dirs]))
end

#has_modified?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/gity/status_list.rb', line 11

def has_modified?
  @list[:modified].nil? ? false : (not_empty?(@list[:modified][:files]) or not_empty?(@list[:modified][:dirs]))
end

#has_new?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/gity/status_list.rb', line 15

def has_new?
  @list[:new].nil? ? false : (not_empty?(@list[:new][:files]) or not_empty?(@list[:new][:dirs]))
end

#has_staged?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/gity/status_list.rb', line 23

def has_staged?
  @list[:staged].nil? ? false : (not_empty?(@list[:staged][:files]) or not_empty?(@list[:staged][:dirs]))
end