chartdecorator 1.0.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 +7 -0
- data/lib/chart_decorator.rb +49 -0
- metadata +42 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 49ecf3210e73fcbf410fd4572f9f1c71df4856f523a9e1d18aff1bf3ca658f71
|
4
|
+
data.tar.gz: 613cd5e510a86522d7e957bd450bca47747703ba7b4a8a20af48de60f947ca27
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4c50672c5db5b9a1bf6b77711fffa3272679a4b65a3df64aa3d407c42db6d79f3ba2e8a3f06d7fdd2c037a373dc4d4d683f537b2f6cbe92a2e1c7e18f7950772
|
7
|
+
data.tar.gz: efac6ee6ef12acaadc7936991dab5af11d92395802c02fb7bd133ee2c4574ff98fc2790c168917b2b950c5c2dc0a998590b305163cbe2f0c5cf3f0885d0ff29c
|
@@ -0,0 +1,49 @@
|
|
1
|
+
class BasicChart
|
2
|
+
def initialize(chart)
|
3
|
+
@chart = chart
|
4
|
+
end
|
5
|
+
def draw
|
6
|
+
return "basic chart"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class ChartDecorator
|
11
|
+
def initialize(real_chart)
|
12
|
+
@real_chart = real_chart
|
13
|
+
@features = "no feature"
|
14
|
+
end
|
15
|
+
|
16
|
+
# override the cost method to include the cost of the extra feature
|
17
|
+
|
18
|
+
# override the details method to include the description of the extra feature
|
19
|
+
def draw
|
20
|
+
return "Chart Decorator"
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
# a concrete decorator
|
26
|
+
class LineChartDecorator < ChartDecorator
|
27
|
+
def initialize(real_chart)
|
28
|
+
super(real_chart)
|
29
|
+
@features = "Line Chart"
|
30
|
+
end
|
31
|
+
|
32
|
+
# override the details method to include the description of the extra feature and its corresponding price
|
33
|
+
def draw
|
34
|
+
return @features+"."+@real_chart.draw
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# a concrete decorator
|
39
|
+
class ColumnChartDecorator < ChartDecorator
|
40
|
+
def initialize(real_chart)
|
41
|
+
super(real_chart)
|
42
|
+
@features = "Column Chart"
|
43
|
+
end
|
44
|
+
|
45
|
+
# override the details method to include the description of the extra feature and its corresponding price
|
46
|
+
def draw
|
47
|
+
return @features+"."+@real_chart.draw
|
48
|
+
end
|
49
|
+
end
|
metadata
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chartdecorator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sarath Ravichandran
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-12-04 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: ChartDecorator.
|
14
|
+
email: sarath.ravichandran@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/chart_decorator.rb
|
20
|
+
homepage: http://rubygems.org/gems/chartdecorator
|
21
|
+
licenses: []
|
22
|
+
metadata: {}
|
23
|
+
post_install_message:
|
24
|
+
rdoc_options: []
|
25
|
+
require_paths:
|
26
|
+
- lib
|
27
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
requirements: []
|
38
|
+
rubygems_version: 3.0.3
|
39
|
+
signing_key:
|
40
|
+
specification_version: 4
|
41
|
+
summary: ChartDecorator.
|
42
|
+
test_files: []
|