Class: Monocle::ListCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/monocle/list_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeListCommand

Returns a new instance of ListCommand.



7
8
9
# File 'lib/monocle/list_command.rb', line 7

def initialize
  @view_names = Dir[File.join(views_path, "*.sql")].map { |f| File.basename(f, ".sql") }
end

Instance Attribute Details

#view_namesObject (readonly)

Returns the value of attribute view_names.



5
6
7
# File 'lib/monocle/list_command.rb', line 5

def view_names
  @view_names
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
# File 'lib/monocle/list_command.rb', line 11

def call
  {}.tap do |hash|
    view_names.each do |view_name|
      hash[view_name.to_sym] = View.new(view_name)
    end
  end
end