Module: Hub::Data

Defined in:
lib/hub/data.rb

Defined Under Namespace

Classes: Data

Constant Summary collapse

CONFIG_DATA =

The raw YAML (Hash)

YAML.load_file(Rails.root + 'config/interface/hub/data.yml')
SECTIONS =
CONFIG_DATA.keys
INDEX =

A Hash of prefix => UserTasks::UserTask

data
BY_NAME =
by_name

Class Method Summary collapse

Class Method Details

.items_for(section) ⇒ Object

Parameters:

  • section (String)

Returns:

  • (Object)


116
117
118
# File 'lib/hub/data.rb', line 116

def self.items_for(section)
  INDEX[section]
end

Returns translate a related prefix into a name string if present, else return the string as is.

Parameters:

  • prefix (String)

Returns:

  • (String)

    translate a related prefix into a name string if present, else return the string as is



129
130
131
132
133
134
135
# File 'lib/hub/data.rb', line 129

def self.related_name(prefix)
  if t = INDEXED_TASKS[prefix]
    t.name
  else
    prefix
  end
end

Parameters:

  • prefix (String)

Returns:

  • (Object)


139
140
141
# File 'lib/hub/data.rb', line 139

def self.related_routes(prefix)
  INDEXED_TASKS[prefix].related
end

.visual_items_for(section) ⇒ Array

Parameters:

  • section (String)

Returns:

  • (Array)


122
123
124
# File 'lib/hub/data.rb', line 122

def self.visual_items_for(section)
  INDEX[section].select{|a| !a.hide}.sort_by(&:name)
end