Class: ListProjects

Inherits:
Struct
  • Object
show all
Defined in:
lib/commands/list_projects.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#criteriaObject

Returns the value of attribute criteria

Returns:

  • (Object)

    the current value of criteria



1
2
3
# File 'lib/commands/list_projects.rb', line 1

def criteria
  @criteria
end

#formatObject

Returns the value of attribute format

Returns:

  • (Object)

    the current value of format



1
2
3
# File 'lib/commands/list_projects.rb', line 1

def format
  @format
end

Instance Method Details

#call(formatter_class = formatter_class, projects = projects) ⇒ Object



2
3
4
# File 'lib/commands/list_projects.rb', line 2

def call formatter_class = formatter_class, projects = projects
  formatter(formatter_class).present projects
end

#default_format(projects = projects) ⇒ Object



14
15
16
# File 'lib/commands/list_projects.rb', line 14

def default_format projects = projects
  {'Name' => 'name'}.merge list_properties_format properties
end

#formatter(formatter_class, format = format.present? ? eval(format) : default_format) ⇒ Object



10
11
12
# File 'lib/commands/list_projects.rb', line 10

def formatter(formatter_class, format = format.present? ? eval(format) : default_format)
  formatter_class.new format
end

#projects(catalog = ProjectCatalog.load, criteria = criteria) ⇒ Object



6
7
8
# File 'lib/commands/list_projects.rb', line 6

def projects catalog = ProjectCatalog.load, criteria = criteria
  catalog.projects criteria
end