rest_my_case 1.7.6 → 1.7.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4588052e9256675a40b1492736a74e1466cee23d
4
- data.tar.gz: a751a68e478e887958d3fb4f074707d2593cd7d2
3
+ metadata.gz: 43474357b7c496bd1f34e7bd8be1b1f56483bcd0
4
+ data.tar.gz: 0569ccb88a347d4481c875885c2f5d6a4551e512
5
5
  SHA512:
6
- metadata.gz: 08eed7254db1385d42d5ef9c491d8c1be1140ad8193f970ec28832521760163e4f25f0cd3a5a65e1758ac8e77d8840612bacffbe9a5959ef4b72ebc3fd90bda5
7
- data.tar.gz: d5f719954f71570c0df7396e30dc15026fd23ff37e4efac08c37cf08dd7bfa6b34ada56e4ffbcbef62d53d23619cf6bc213cb33ffaf7d74deee8432e24ef1c86
6
+ metadata.gz: 4c3408044404288bab81a2f03993a9ac42ae3bb8601884103e45bd642bc1ba192501bc5a06f849ebf171d9a2668bbd5ca8ffb0bd42033a9584bb19d8f5fe4461
7
+ data.tar.gz: b7d260bc16ea7daf2174a51b5455a71a5424bbadcc5bae26c43f12ff2a04f3c51af672a07031c86b11469d29f7d18eb0632418c378dad98c87644501f91a365b
@@ -6,7 +6,7 @@ module RestMyCase
6
6
 
7
7
  def self.trial_court
8
8
  @trial_court ||= Trial::Court.new \
9
- Judge::Base, DefenseAttorney::Base, RestMyCase::Base
9
+ Judge::Base, DefenseAttorney::Base, RestMyCase::Base, Context::Base
10
10
  end
11
11
 
12
12
  def self.depends(*use_case_classes)
@@ -5,10 +5,14 @@ module RestMyCase
5
5
 
6
6
  attr_accessor :use_cases, :should_abort
7
7
 
8
- attr_reader :context, :defendant, :last_ancestor, :defendant_class
9
-
10
- def initialize(last_ancestor, use_case_classes, attributes)
11
- @context = build_context attributes
8
+ attr_reader :context,
9
+ :defendant,
10
+ :last_ancestor,
11
+ :context_class,
12
+ :defendant_class
13
+
14
+ def initialize(last_ancestor, context_class, use_case_classes, attributes)
15
+ @context = build_context attributes, context_class
12
16
  @last_ancestor = last_ancestor
13
17
  @defendant_class = build_defendant(last_ancestor, use_case_classes)
14
18
  @defendant = @defendant_class.new @context
@@ -20,10 +24,10 @@ module RestMyCase
20
24
 
21
25
  protected ######################## PROTECTED #############################
22
26
 
23
- def build_context(attributes)
24
- return attributes if attributes.is_a?(Context::Base)
27
+ def build_context(attributes, context_class)
28
+ return attributes if attributes.is_a?(context_class)
25
29
 
26
- Context::Base.new attributes
30
+ context_class.new attributes
27
31
  end
28
32
 
29
33
  def build_defendant(last_ancestor, use_case_classes)
@@ -1,10 +1,12 @@
1
1
  module RestMyCase
2
2
  module Trial
3
3
 
4
- Court = Struct.new(:judge_class, :defense_attorney_class, :last_ancestor) do
4
+ Court = Struct.new \
5
+ :judge_class, :defense_attorney_class, :last_ancestor, :context_class do
5
6
 
6
7
  def execute(use_case_classes, attributes = {})
7
- trial_case = Case.new(last_ancestor, use_case_classes, attributes)
8
+ trial_case = Case.new \
9
+ last_ancestor, context_class, use_case_classes, attributes
8
10
 
9
11
  defense_attorney_class.new(trial_case).build_case_for_the_defendant
10
12
 
@@ -10,7 +10,7 @@ module RestMyCase
10
10
 
11
11
  def trial_court
12
12
  @trial_court ||= Trial::Court.new \
13
- Judge::Base, DefenseAttorney::Base, RestMyCase::Validator
13
+ Judge::Base, DefenseAttorney::Base, Validator, Context::Base
14
14
  end
15
15
 
16
16
  def target_name
@@ -1,5 +1,5 @@
1
1
  module RestMyCase
2
2
 
3
- VERSION = '1.7.6'
3
+ VERSION = '1.7.7'
4
4
 
5
5
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe RestMyCase::DefenseAttorney::Base do
4
4
 
5
5
  let(:use_cases) do
6
- trial_case = RestMyCase::Trial::Case.new(RestMyCase::Base, use_case_classes, id: 1)
6
+ trial_case = RestMyCase::Trial::Case.new(RestMyCase::Base, RestMyCase::Context::Base, use_case_classes, id: 1)
7
7
 
8
8
  described_class.new(trial_case).build_case_for_the_defendant
9
9
 
@@ -6,7 +6,7 @@ describe RestMyCase::Trial::Court do
6
6
  before do
7
7
  @use_case_class = Class.new(RestMyCase::Base)
8
8
  @trial_court = described_class.new \
9
- RestMyCase::Judge::Base, RestMyCase::DefenseAttorney::Base, RestMyCase::Base
9
+ RestMyCase::Judge::Base, RestMyCase::DefenseAttorney::Base, RestMyCase::Base, RestMyCase::Context::Base
10
10
  end
11
11
 
12
12
  context "When something that responds to #to_hash is passed down" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest_my_case
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.6
4
+ version: 1.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - goncalvesjoao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-23 00:00:00.000000000 Z
11
+ date: 2015-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry