s44_myweatherforecast 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2ae4c2c3173a6fa454e167bbb53c93794ee08647
4
+ data.tar.gz: 47df4444d827e5511e265977036432097b414b73
5
+ SHA512:
6
+ metadata.gz: 4418a0fead188e9a5274c2ba06ec63301c63a6ff304345dcb66b95d413fac3c369015dd3eb5e5cda51ef603ffcb8a5e05891f4536c2c54f5783adec558a56d47
7
+ data.tar.gz: eeecbeca09b1e62471ae7073966f5b68e1877a790fef9c1be333713f6622665382a2d61417b7983ea3a688e1672fa8637a3176245ae0b3700f6162e73069f3d6
checksums.yaml.gz.sig ADDED
@@ -0,0 +1 @@
1
+ EϨw.ɴ\Ȭ�{����]m!~��ᄾ�G ),X�]f�A�c:�٘ݍ�Oh=e���qI��׳*�����ɞ�3)Γ1��{�yQ����9�ξ^rY�����L�����:X�V��P;2�D��>�zuC��h($h��+4bE
data.tar.gz.sig ADDED
@@ -0,0 +1,3 @@
1
+ �F�&�IT�=ϑ�&>j��W�~��Teyp���g��J�����bM;'R����g��+�P�� r
2
+ �?�)AEt��w]�;
3
+ O�K�oI��rJ�s��,�S����^�R�yC�>n0�C=��
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: s44_myweatherforecast.rb
4
+
5
+
6
+ class S44_MyWeatherForecast
7
+
8
+ def initialize(myweatherforecast=nil)
9
+ @w = myweatherforecast
10
+ end
11
+
12
+ def afternoon()
13
+ summary(:afternoon)
14
+ end
15
+
16
+ alias this_afternoon afternoon
17
+
18
+ private
19
+
20
+ def summary(period)
21
+
22
+ a = @w.this.method(period).call
23
+ min, max = a.minmax_by {|x| x.temperature}.map(&:temperature)
24
+ a.map(&:summary).uniq
25
+
26
+ a2 = a.map(&:summary).uniq
27
+
28
+ s2 = if a2.length < 2 then
29
+ a2[0]
30
+ elsif a2.length < 3 then
31
+ a2.join ', but also '
32
+ else
33
+ "%s, but also %s" % [a2[0..-2].join(', '), a2[-1]]
34
+ end
35
+
36
+ s3 = "with a minimum temperature of #{min} celcius " +
37
+ "and a maximum temperature of #{max} celcius"
38
+
39
+ s1 = "The weather this #{period.to_s} is to be"
40
+
41
+ [s1, s2.downcase, s3].join(' ') + '.'
42
+
43
+ end
44
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: s44_myweatherforecast
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE2MDIyMzE0MzYwNVoXDTE3MDIyMjE0MzYwNVowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAKYybpHD7rEZnR1MIQ72KYo2fj3aiBTm/clv0cn3ZpPzamF7Qluv55KMSq1P
19
+ i+Hrhji3dLozYEHuAbYjGqTEvGDQUeRQwPoKromzcy0fCs4LuIFjE4DJ3f5oKZzN
20
+ eQ7PLhdMOUzbQ+rrwnRHF34L/APjMk+fTx5mze3bfPwOsDY0kBM17GIvNFXT+JZW
21
+ slhi8Mb9LfCUEfpTJMU1G/1nvyHsPp689T6A92ZAbQPPFVxsN7Sse4Bboles/dT9
22
+ qCIwrE/0Wcr6dzCJ1pHBxydK7d+P1IkK8RPQO5BxyBYCse4ZxXFqk4CJorSnlKhc
23
+ /O8TIvHvjTRRlIufGDUajvh98nsCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUxD77mTAoPK5sBFTExPJj50DYCS0wJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAmUH+8elG
27
+ ZJErkp2yqN+eJmPbrUwHMfQw6C2DbGaQlA1prJg6GIym/IsJYtOBgAF6RLJRh0eO
28
+ 5oQGknsx3NIKd67U76RrzSammaOeBQYj7GQi7fbkSvxwyrpqGm8hxIAd61QWCTU4
29
+ JoNeRelFKkmtZPhgaIdsbK7lcNQFev4Mcdwbc7Yx/6IW+oTiBClv4Ka+tNzV76Q+
30
+ fSiKS06XECGrcGfZ0cFkSLXllfXuNF68QOW3dm4eeirSMQ30ZBS+jC9GfrZKqQQp
31
+ RwuZgcNnRHCCsL8QVrAudO6l9wspGYwR44iA4auqhaicCazbT+czO400tpJElVl5
32
+ KMwma1iA/XVt5w==
33
+ -----END CERTIFICATE-----
34
+ date: 2016-02-23 00:00:00.000000000 Z
35
+ dependencies: []
36
+ description:
37
+ email: james@r0bertson.co.uk
38
+ executables: []
39
+ extensions: []
40
+ extra_rdoc_files: []
41
+ files:
42
+ - lib/s44_myweatherforecast.rb
43
+ homepage: https://github.com/jrobertson/s44_myweatherforecast
44
+ licenses:
45
+ - MIT
46
+ metadata: {}
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubyforge_project:
63
+ rubygems_version: 2.4.8
64
+ signing_key:
65
+ specification_version: 4
66
+ summary: 'Under development: Uses the myweatherforecast gem to generates a summary
67
+ of the weather forecast in plain English.'
68
+ test_files: []
metadata.gz.sig ADDED
Binary file