openstudio-recommendation-engine 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,32 +30,32 @@ module OpenStudio
30
30
  def init
31
31
  measure_checks = Dir.glob("#{@path_to_measures}/**/recommendation.rb")
32
32
 
33
- puts "List of measures: #{measure_checks.inspect}"
34
- results = []
33
+ applicable_measures = []
34
+
35
35
  measure_checks.each do |measure|
36
36
  require "#{File.expand_path(measure)}"
37
37
 
38
38
  measure_class_name = File.basename(File.expand_path("../..",measure))
39
39
  puts "measure class name is: #{measure_class_name}"
40
-
41
- m = measure_class_name.constantize.new
42
- puts m.inspect
43
-
44
- # recommendation engine ?
45
- #require "#{a.name}::MeasureApplciblitychere.new()."
40
+
41
+ measure = Object.const_get(measure_class_name).new
46
42
 
47
43
  if @model
48
- measure_check = Measure::MeasureApplicabilityChecker.new(@model)
49
- measure_check.check_applicability
44
+ result = measure.check_applicability(@model)
45
+ if result
46
+ applicable_measures << result
47
+ else
48
+ puts "measure #{measure_class_name} not applicable"
49
+ end
50
50
  else
51
51
  raise "No model passed into the recommendation engine"
52
52
  end
53
53
 
54
-
55
- results << measure_check.result
56
54
  end
57
55
 
58
- return results
56
+ applicable_measures_json = JSON.pretty_generate(applicable_measures)
57
+ puts applicable_measures_json
58
+ return applicable_measures_json
59
59
 
60
60
  end
61
61
 
@@ -19,6 +19,6 @@
19
19
 
20
20
  module OpenStudio
21
21
  module RecommendationEngine
22
- VERSION = "0.1.0"
22
+ VERSION = "0.1.1"
23
23
  end
24
24
  end
@@ -7,11 +7,10 @@ rescue
7
7
  $openstudio_loaded = false
8
8
  end
9
9
 
10
- require 'active_support/core_ext/string' # for constantize
11
10
  require 'parallel'
12
11
  require 'openstudio/recommendation_engine/recommendation_engine'
13
12
  require 'openstudio/recommendation_engine/version'
14
13
  require 'openstudio/helpers/safe_load'
15
-
14
+ require 'json/pure'
16
15
 
17
16
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstudio-recommendation-engine
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nicholas Long
@@ -33,7 +33,7 @@ dependencies:
33
33
  type: :runtime
34
34
  requirement: *id001
35
35
  - !ruby/object:Gem::Dependency
36
- name: active_support
36
+ name: json_pure
37
37
  version_requirements: &id002 !ruby/object:Gem::Requirement
38
38
  none: false
39
39
  requirements:
@@ -58,7 +58,7 @@ files:
58
58
  - lib/openstudio/helpers/safe_load.rb
59
59
  - lib/openstudio/recommendation_engine/recommendation_engine.rb
60
60
  - lib/openstudio/recommendation_engine/version.rb
61
- - lib/recommendation_engine.rb
61
+ - lib/openstudio_recommendation_engine.rb
62
62
  homepage: http://openstudio.nrel.gov
63
63
  licenses:
64
64
  - LGPL