6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/generators/bottled_service/bottled_service_generator.rb', line 6
def generate_bottled_service
puts "Generating Bottled Service: #{name}"
create_file "app/services/#{file_name}.rb", <<-File
class #{class_name} < BottledService
#{ "".tap do |str|
attributes.each do |attribute|
puts "injecting attribute: #{attribute.name}"
if attribute.type.present?
str << "att :#{attribute.name}, #{attribute.type}
"
else
str << "att :#{attribute.name}
"
end
end
end
}
def call
# Do something...
yield if block_given?
end
end
File
end
|