Class: Gloo::Objs::Stats

Inherits:
Core::Obj show all
Defined in:
lib/gloo/objs/dev/stats.rb

Constant Summary collapse

KEYWORD =
'stats'.freeze
KEYWORD_SHORT =
'stat'.freeze
FOLDER =
'folder'.freeze
TYPES =
'types'.freeze
SKIP =
'skip'.freeze

Constants inherited from Core::Baseo

Core::Baseo::NOT_IMPLEMENTED_ERR

Instance Attribute Summary

Attributes inherited from Core::Obj

#children, #parent, #value

Attributes inherited from Core::Baseo

#name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Core::Obj

#add_child, can_create?, #can_receive_message?, #child_count, #contains_child?, #delete_children, #dispatch, #display_value, #find_add_child, #find_child, help, inherited, #initialize, #msg_reload, #msg_unload, #multiline_value?, #pn, #remove_child, #root?, #send_message, #set_parent, #set_value, #type_display, #value_display, #value_is_array?, #value_is_blank?, #value_string?

Methods inherited from Core::Baseo

#initialize, #type_display

Constructor Details

This class inherits a constructor from Gloo::Core::Obj

Class Method Details

.messagesObject

Get a list of message names that this object receives.



88
89
90
91
92
# File 'lib/gloo/objs/dev/stats.rb', line 88

def self.messages
  all = %w[show_all]
  more = %w[show_busy_folders show_types]
  return super + all + more
end

.short_typenameObject

The short name of the object type.



27
28
29
# File 'lib/gloo/objs/dev/stats.rb', line 27

def self.short_typename
  return KEYWORD_SHORT
end

.typenameObject

The name of the object type.



20
21
22
# File 'lib/gloo/objs/dev/stats.rb', line 20

def self.typename
  return KEYWORD
end

Instance Method Details

#add_children_on_create?Boolean

Does this object have children to add when an object is created in interactive mode? This does not apply during obj load, etc.

Returns:



65
66
67
# File 'lib/gloo/objs/dev/stats.rb', line 65

def add_children_on_create?
  return true
end

#add_default_childrenObject

Add children to this object. This is used by containers to add children needed for default configurations.



74
75
76
77
78
79
# File 'lib/gloo/objs/dev/stats.rb', line 74

def add_default_children
  fac = @engine.factory
  fac.create_file FOLDER, '', self
  fac.create_string TYPES, '', self
  fac.create_can SKIP, self
end

#msg_show_allObject

Show all project stats.



97
98
99
100
101
# File 'lib/gloo/objs/dev/stats.rb', line 97

def msg_show_all
  o = Gloo::Utils::Stats.new(
    @engine, path_value, types_value, skip_list )
  o.show_all
end

#msg_show_busy_foldersObject

Show busy folders: those with the most files.



115
116
117
118
119
# File 'lib/gloo/objs/dev/stats.rb', line 115

def msg_show_busy_folders
  o = Gloo::Utils::Stats.new(
    @engine, path_value, types_value, skip_list )
  o.busy_folders
end

#msg_show_typesObject

Show file types.



106
107
108
109
110
# File 'lib/gloo/objs/dev/stats.rb', line 106

def msg_show_types
  o = Gloo::Utils::Stats.new(
    @engine, path_value, types_value, skip_list )
  o.file_types
end

#path_valueObject

Get the path to the git repo (locally).



34
35
36
37
# File 'lib/gloo/objs/dev/stats.rb', line 34

def path_value
  o = find_child FOLDER
  return o ? o.value : nil
end

#skip_listObject

Get the list of files and folders to skip.



50
51
52
53
54
# File 'lib/gloo/objs/dev/stats.rb', line 50

def skip_list
  o = find_child SKIP
  val = o ? o.value : ''
  return val.split ' '
end

#types_valueObject

The code file types to count.



42
43
44
45
# File 'lib/gloo/objs/dev/stats.rb', line 42

def types_value
  o = find_child TYPES
  return o ? o.value : ''
end