sniff 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/sniff/emitter.rb CHANGED
@@ -29,7 +29,6 @@ module Sniff
29
29
  module ClassMethods
30
30
  def from_params_hash(params = Hash.new)
31
31
  resolved_params = Hash.new
32
- instance = new
33
32
  associations = reflect_on_all_associations
34
33
  params.each do |k, v|
35
34
  next if v.blank?
@@ -54,12 +53,6 @@ module Sniff
54
53
  new resolved_params
55
54
  end
56
55
 
57
- def add_implicit_characteristics
58
- decisions[:emission].committees.map(&:name).reject { |c| characteristics.keys.unshift(:emission).include? c }.each do |c|
59
- characterize { has c }
60
- end
61
- end
62
-
63
56
  def _common_name
64
57
  name.underscore
65
58
  end
@@ -17,7 +17,9 @@ Given /^an? (.+) has "(.+)" of "(.*)"$/ do |emitter, field, value|
17
17
  end
18
18
 
19
19
  Given /^it has "(.+)" of "(.*)"$/ do |field, value|
20
- if value.present?
20
+ if value =~ /[\d-]+\/[\d-]+/
21
+ @timeframe = Timeframe.interval(value)
22
+ elsif value.present?
21
23
  methods = field.split('.')
22
24
  context = @activity_hash
23
25
  methods.each do |method|
@@ -35,13 +37,14 @@ Given /^the current date is "(.+)"$/ do |current_date|
35
37
  end
36
38
 
37
39
  When /^emissions are calculated$/ do
40
+ @timeframe ||= Timeframe.this_year
38
41
  @activity = @emitter_class.from_params_hash @activity_hash
39
42
  if @current_date
40
43
  Timecop.travel(@current_date) do
41
- @emission = @activity.emission Timeframe.this_year
44
+ @emission = @activity.emission @timeframe
42
45
  end
43
46
  else
44
- @emission = @activity.emission Timeframe.this_year
47
+ @emission = @activity.emission @timeframe
45
48
  end
46
49
  @characteristics = @activity.deliberations[:emission].characteristics
47
50
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sniff
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Derek Kastner
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-23 00:00:00 -04:00
18
+ date: 2010-10-18 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency