Class: Gloo::Objs::Stats

Inherits:
GlooLang::Core::Obj
  • Object
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

Class Method Summary collapse

Instance Method Summary collapse

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:

  • (Boolean)


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 = GlooLang::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 = GlooLang::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 = GlooLang::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