rest_my_case 1.7.6 → 1.7.7
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.
- checksums.yaml +4 -4
- data/lib/rest_my_case/base.rb +1 -1
- data/lib/rest_my_case/trial/case.rb +11 -7
- data/lib/rest_my_case/trial/court.rb +4 -2
- data/lib/rest_my_case/validator.rb +1 -1
- data/lib/rest_my_case/version.rb +1 -1
- data/spec/rest_my_case/defense_attorney/base_spec.rb +1 -1
- data/spec/rest_my_case/trial_case/court_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43474357b7c496bd1f34e7bd8be1b1f56483bcd0
|
4
|
+
data.tar.gz: 0569ccb88a347d4481c875885c2f5d6a4551e512
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c3408044404288bab81a2f03993a9ac42ae3bb8601884103e45bd642bc1ba192501bc5a06f849ebf171d9a2668bbd5ca8ffb0bd42033a9584bb19d8f5fe4461
|
7
|
+
data.tar.gz: b7d260bc16ea7daf2174a51b5455a71a5424bbadcc5bae26c43f12ff2a04f3c51af672a07031c86b11469d29f7d18eb0632418c378dad98c87644501f91a365b
|
data/lib/rest_my_case/base.rb
CHANGED
@@ -5,10 +5,14 @@ module RestMyCase
|
|
5
5
|
|
6
6
|
attr_accessor :use_cases, :should_abort
|
7
7
|
|
8
|
-
attr_reader :context,
|
9
|
-
|
10
|
-
|
11
|
-
|
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?(
|
27
|
+
def build_context(attributes, context_class)
|
28
|
+
return attributes if attributes.is_a?(context_class)
|
25
29
|
|
26
|
-
|
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
|
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
|
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
|
|
data/lib/rest_my_case/version.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2015-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|