cascade-rb 0.2.3 → 0.3.0
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/.hound.yml +1 -1
- data/.rubocop.yml +11 -0
- data/.travis.yml +11 -0
- data/Gemfile +3 -1
- data/README.md +2 -25
- data/Rakefile +7 -4
- data/cascade.gemspec +22 -21
- data/lib/cascade.rb +6 -7
- data/lib/cascade/columns_matching.rb +14 -13
- data/lib/cascade/complex_fields.rb +5 -3
- data/lib/cascade/complex_fields/array_processor.rb +2 -0
- data/lib/cascade/complex_fields/boolean.rb +3 -1
- data/lib/cascade/complex_fields/currency.rb +8 -4
- data/lib/cascade/concerns/statistics_collectible.rb +3 -1
- data/lib/cascade/data_parser.rb +4 -2
- data/lib/cascade/error_handler.rb +4 -7
- data/lib/cascade/exceptions.rb +5 -3
- data/lib/cascade/exceptions/unknown_presenter_type.rb +2 -0
- data/lib/cascade/exceptions/unsupported_component.rb +3 -1
- data/lib/cascade/exceptions/wrong_mapping_format.rb +2 -0
- data/lib/cascade/helpers/hash.rb +2 -0
- data/lib/cascade/registry.rb +6 -3
- data/lib/cascade/row_processor.rb +23 -22
- data/lib/cascade/statistics.rb +4 -2
- data/lib/cascade/statistics_stores.rb +5 -3
- data/lib/cascade/statistics_stores/abstract_store.rb +2 -0
- data/lib/cascade/statistics_stores/array_store.rb +2 -0
- data/lib/cascade/statistics_stores/counter_store.rb +2 -0
- data/lib/cascade/version.rb +3 -1
- data/spec/integration_spec.rb +70 -0
- data/spec/lib/columns_matching_spec.rb +18 -26
- data/spec/lib/complex_fields/array_processor_spec.rb +6 -4
- data/spec/lib/complex_fields/boolean_spec.rb +8 -6
- data/spec/lib/complex_fields/currency_spec.rb +11 -9
- data/spec/lib/concerns/statistics_collectible_spec.rb +6 -4
- data/spec/lib/data_parser_spec.rb +14 -11
- data/spec/lib/error_handler_spec.rb +21 -15
- data/spec/lib/exceptions/unknown_presenter_type_spec.rb +5 -3
- data/spec/lib/exceptions/unsupported_component_spec.rb +10 -8
- data/spec/lib/exceptions/wrong_mapping_format_spec.rb +5 -3
- data/spec/lib/helpers/hash_spec.rb +7 -5
- data/spec/lib/registry_spec.rb +9 -8
- data/spec/lib/row_processor_spec.rb +33 -33
- data/spec/lib/statistics_spec.rb +14 -12
- data/spec/lib/statistics_stores/abstract_store_spec.rb +7 -5
- data/spec/lib/statistics_stores/array_store_spec.rb +8 -6
- data/spec/lib/statistics_stores/counter_store_spec.rb +8 -6
- data/spec/spec_helper.rb +16 -15
- metadata +28 -28
- data/.ruby-style.yml +0 -1063
- data/lib/cascade/helpers/configuration.rb +0 -32
- data/spec/lib/helpers/configuration_spec.rb +0 -36
@@ -1,32 +0,0 @@
|
|
1
|
-
module Configuration
|
2
|
-
def configuration
|
3
|
-
yield self
|
4
|
-
end
|
5
|
-
|
6
|
-
def define_setting(name, default = nil)
|
7
|
-
class_variable_set("@@#{name}", default)
|
8
|
-
|
9
|
-
define_cattr_reader(name)
|
10
|
-
define_cattr_writer(name)
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def define_cattr_reader(name)
|
16
|
-
define_class_method name do
|
17
|
-
class_variable_get("@@#{name}")
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def define_cattr_writer(name)
|
22
|
-
define_class_method "#{name}=" do |value|
|
23
|
-
class_variable_set("@@#{name}", value)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def define_class_method(name, &block)
|
28
|
-
(class << self; self; end).instance_eval do
|
29
|
-
define_method name, &block
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "cascade/helpers/configuration"
|
3
|
-
|
4
|
-
describe Configuration do
|
5
|
-
class ExtendableClass
|
6
|
-
extend Configuration
|
7
|
-
|
8
|
-
define_setting :simple_setting
|
9
|
-
define_setting :setting_with_default, 42
|
10
|
-
end
|
11
|
-
|
12
|
-
it "defines class variables with curresponding default values" do
|
13
|
-
assert_equal ExtendableClass.class_variables,
|
14
|
-
[:@@simple_setting, :@@setting_with_default]
|
15
|
-
end
|
16
|
-
|
17
|
-
it "defines reader methods for extended class" do
|
18
|
-
assert_respond_to ExtendableClass, :simple_setting
|
19
|
-
assert_respond_to ExtendableClass, :setting_with_default
|
20
|
-
end
|
21
|
-
|
22
|
-
it "defines write accessor for extended class" do
|
23
|
-
assert_respond_to ExtendableClass, :simple_setting=
|
24
|
-
assert_respond_to ExtendableClass, :setting_with_default=
|
25
|
-
end
|
26
|
-
|
27
|
-
it "allows to set class variables in configuration block" do
|
28
|
-
ExtendableClass.configuration do |config|
|
29
|
-
config.simple_setting = :value
|
30
|
-
config.setting_with_default = 29
|
31
|
-
end
|
32
|
-
|
33
|
-
assert_equal ExtendableClass.setting_with_default, 29
|
34
|
-
assert_equal ExtendableClass.simple_setting, :value
|
35
|
-
end
|
36
|
-
end
|