Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
weather-model
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
weather-model
Commits
d626d089
Commit
d626d089
authored
May 20, 2017
by
Ivan Lan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'lan/fix_file_loading_bug' into 'master'
Lan/fix file loading bug See merge request
!5
parents
8c11eb17
88dfe1bc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
11 deletions
+10
-11
weather-model.rb
lib/weather-model.rb
+4
-4
source_schema.rb
lib/weather-model/source_schema.rb
+5
-6
aqi.rb
lib/weather-model/source_schemas/aqi.rb
+1
-1
No files found.
lib/weather-model.rb
View file @
d626d089
...
@@ -5,10 +5,10 @@ module WeatherModel
...
@@ -5,10 +5,10 @@ module WeatherModel
require
'factory_girl_rails'
require
'factory_girl_rails'
def
self
.
included
base
def
self
.
included
base
WeatherModel
::
SourceSchema
.
sorts
.
each
{
|
sort
|
Object
.
const_set
(
sort
,
Module
.
new
)}
::
WeatherModel
::
SourceSchema
.
sorts
.
each
{
|
sort
|
::
WeatherModel
.
const_set
(
sort
,
Module
.
new
)}
WeatherModel
::
SourceSchema
.
constants
.
each
do
|
source
|
::
WeatherModel
::
SourceSchema
.
constants
.
each
do
|
source
|
settings
=
SourceSchema
.
const_get
(
source
)
settings
=
::
WeatherModel
::
SourceSchema
.
const_get
(
source
)
Object
.
const_get
(
settings
[
:sort
]).
const_set
(
"
#{
source
.
to_s
.
gsub
(
'_'
,
'::'
)
}
"
,
Class
.
new
(
Storer
::
Mysql
)).
use_settings
(
settings
)
::
WeatherModel
.
const_get
(
settings
[
:sort
]).
const_set
(
source
,
Class
.
new
(
Storer
::
Mysql
)).
use_settings
(
settings
)
end
end
end
end
...
...
lib/weather-model/source_schema.rb
View file @
d626d089
module
WeatherModel
module
WeatherModel
module
SourceSchema
module
SourceSchema
def
self
.
sorts
def
self
.
sorts
[
:Forecast
,
:AutoStation
,
:Aqi
]
[
:Forecast
,
:AutoStation
,
:Aqi
]
end
end
Dir
[
File
.
join
(
File
.
dirname
(
__FILE__
),
'source_schemas/*.rb'
)].
each
{
|
file
|
require
file
}
end
end
end
end
Dir
[
'./lib/weather-model/source_schemas/*.rb'
].
each
{
|
file
|
require
file
}
\ No newline at end of file
lib/weather-model/source_schemas/aqi.rb
View file @
d626d089
module
WeatherModel
module
WeatherModel
module
SourceSchema
module
SourceSchema
Forecast
=
Aqi
Forecast
=
{
{
sort:
'Aqi'
,
sort:
'Aqi'
,
table_name: :aqi_forecasts
,
table_name: :aqi_forecasts
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment