Class: Sails::Service::Interface

Inherits:
Object
  • Object
show all
Defined in:
lib/sails/service/interface.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeInterface


6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/sails/service/interface.rb', line 6

def initialize
  @services = []
  Dir["#{Sails.root.join("app/services")}/*_service.rb"].each do |f|
    if File.basename(f) =~ /^(.*)_service.rb$/
      require f
      mtd = $1.dup
      klass_name = "#{mtd.camelize}Service"
      @services << klass_name.constantize.new
    end
  end
  define_service_methods!
end

Instance Attribute Details

#servicesObject

Returns the value of attribute services


4
5
6
# File 'lib/sails/service/interface.rb', line 4

def services
  @services
end