Module: HorsePower
- Defined in:
- lib/horse_power.rb,
lib/horse_power/engine.rb,
lib/horse_power/version.rb,
app/helpers/horse_power/application_helper.rb,
lib/generators/horse_power/user/user_generator.rb,
lib/generators/horse_power/model/model_generator.rb,
lib/generators/horse_power/setup/setup_generator.rb,
lib/generators/horse_power/tests/tests_generator.rb,
app/controllers/horse_power/application_controller.rb,
lib/generators/horse_power/scaffold/scaffold_generator.rb,
lib/generators/horse_power/controller/controller_generator.rb,
lib/generators/horse_power/make_admin/make_admin_generator.rb,
lib/generators/horse_power/serializer/serializer_generator.rb,
lib/generators/horse_power/authorization/authorization_generator.rb,
lib/generators/horse_power/app_environment/app_environment_generator.rb
Defined Under Namespace
Modules: ApplicationHelper
Classes: AppEnvironmentGenerator, ApplicationController, AuthorizationGenerator, ControllerGenerator, Engine, MakeAdminGenerator, ModelGenerator, ScaffoldGenerator, SerializerGenerator, SetupGenerator, TestsGenerator, UserGenerator
Constant Summary
collapse
- VERSION =
"1.0.0"
Class Method Summary
collapse
Class Method Details
.default_values(field1) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/horse_power.rb', line 39
def self.default_values(field1)
field = field1.downcase
if field == "integer"
return 1
end
if field == "boolean"
return true
end
if field == "string"
return "\"Default String\""
end
if field == "text"
return "\"Default Text\""
end
if field == "float"
return 3.14
end
if field == "decimal"
return 3.14159
end
if field == "date"
return "\"#{Date.new}\""
end
if field == "time"
return "\"#{Time.new}\""
end
if field == "datetime"
return "\"#{DateTime.new}\""
end
return nil
end
|
.get_camel(resource) ⇒ Object
31
32
33
|
# File 'lib/horse_power.rb', line 31
def self.get_camel(resource)
return resource.camelize.singularize
end
|
.get_camel_plural(resource) ⇒ Object
35
36
37
|
# File 'lib/horse_power.rb', line 35
def self.get_camel_plural(resource)
return self.get_camel(resource).pluralize
end
|
.get_column(pair) ⇒ Object
15
16
17
|
# File 'lib/horse_power.rb', line 15
def self.get_column(pair)
return pair.split(/:/)[0]
end
|
.get_plural(resource) ⇒ Object
27
28
29
|
# File 'lib/horse_power.rb', line 27
def self.get_plural(resource)
return resource.underscore.pluralize
end
|
.get_singular(resource) ⇒ Object
23
24
25
|
# File 'lib/horse_power.rb', line 23
def self.get_singular(resource)
return resource.underscore.singularize
end
|
.get_type(pair) ⇒ Object
19
20
21
|
# File 'lib/horse_power.rb', line 19
def self.get_type(pair)
return pair.split(/:/)[1]
end
|
.params_list(attributes) ⇒ Object
5
6
7
8
9
10
11
12
13
|
# File 'lib/horse_power.rb', line 5
def self.params_list(attributes)
params = []
attributes.each do |pair|
elem = pair.split(/:/)[0]
field = ":#{elem}"
params << field
end
return params.join(",")
end
|