astrological_forecast 1.3.5 → 2.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07b1916031f1ada4f6d0dda98cfd63524f587060102e3e1615b1a6a715b4ce2f
4
- data.tar.gz: 1fc22e725ee0bb125b2c44618240b53b299ab945d18476a5c665bba190c0248c
3
+ metadata.gz: b90d589da98e246f0aa7a80626c98f43cca55cfdc8eda5c8934d066f8588b123
4
+ data.tar.gz: 8fcde1d8fc0d5c38b7de61f291c669301a3aaad432962628635eaf3b396efc6a
5
5
  SHA512:
6
- metadata.gz: c88416b4fe1dae0af0acfb4b05b6de117eb8e74611a212e9ee3923851bd3a4831a3ad5731eace163dc3c88a86de83c5056198bba487e236cf36d153f3355daf0
7
- data.tar.gz: cf5a02b23438efee5324ee79166cb7ded4778eb836ad2810aef29fa74b4a02cde7fc520ed3aa03f401a805167616c327a540478bae55a433fc75547df964803d
6
+ metadata.gz: 405dddb49120483f8545695044df8c5546456487d36307c6498d6cbef1c8cd01ed3c55dae83559701cf896ec9cbb464a5886bd7b9e1dcc965a98513391e3cbad
7
+ data.tar.gz: 48b1e36fa09744670f4a5b50f71dc441778908ceee1ed0baa0213e4a4e6dfbf5ebf0228fedf36d25003e8f78f73d0f53436a362356a710098b1d821bffb5e737
data/Gemfile CHANGED
@@ -18,5 +18,3 @@ group :test do
18
18
  gem 'vcr', '~> 6.1'
19
19
  gem 'webmock', '~> 3.1'
20
20
  end
21
-
22
-
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- astrological_forecast (1.3.5)
4
+ astrological_forecast (2.0.1)
5
5
  addressable
6
6
  nokogiri
7
7
  open-uri
@@ -17,25 +17,25 @@ GEM
17
17
  simplecov (>= 0.15, < 0.22)
18
18
  crack (0.4.5)
19
19
  rexml
20
- date (3.2.2)
20
+ date (3.3.3)
21
21
  diff-lcs (1.5.0)
22
22
  docile (1.4.0)
23
23
  hashdiff (1.0.1)
24
- json (2.6.2)
25
- nokogiri (1.13.9-x86_64-linux)
24
+ json (2.6.3)
25
+ nokogiri (1.14.0-x86_64-linux)
26
26
  racc (~> 1.4)
27
- open-uri (0.2.0)
27
+ open-uri (0.3.0)
28
28
  stringio
29
29
  time
30
30
  uri
31
31
  parallel (1.22.1)
32
- parser (3.1.2.1)
32
+ parser (3.2.0.0)
33
33
  ast (~> 2.4.1)
34
- public_suffix (5.0.0)
35
- racc (1.6.0)
34
+ public_suffix (5.0.1)
35
+ racc (1.6.2)
36
36
  rainbow (3.1.1)
37
37
  rake (13.0.6)
38
- regexp_parser (2.6.0)
38
+ regexp_parser (2.6.1)
39
39
  rexml (3.2.5)
40
40
  rspec (3.12.0)
41
41
  rspec-core (~> 3.12.0)
@@ -43,29 +43,29 @@ GEM
43
43
  rspec-mocks (~> 3.12.0)
44
44
  rspec-core (3.12.0)
45
45
  rspec-support (~> 3.12.0)
46
- rspec-expectations (3.12.0)
46
+ rspec-expectations (3.12.2)
47
47
  diff-lcs (>= 1.2.0, < 2.0)
48
48
  rspec-support (~> 3.12.0)
49
- rspec-mocks (3.12.0)
49
+ rspec-mocks (3.12.2)
50
50
  diff-lcs (>= 1.2.0, < 2.0)
51
51
  rspec-support (~> 3.12.0)
52
52
  rspec-support (3.12.0)
53
- rubocop (1.38.0)
53
+ rubocop (1.43.0)
54
54
  json (~> 2.3)
55
55
  parallel (~> 1.10)
56
- parser (>= 3.1.2.1)
56
+ parser (>= 3.2.0.0)
57
57
  rainbow (>= 2.2.2, < 4.0)
58
58
  regexp_parser (>= 1.8, < 3.0)
59
59
  rexml (>= 3.2.5, < 4.0)
60
- rubocop-ast (>= 1.23.0, < 2.0)
60
+ rubocop-ast (>= 1.24.1, < 2.0)
61
61
  ruby-progressbar (~> 1.7)
62
- unicode-display_width (>= 1.4.0, < 3.0)
63
- rubocop-ast (1.23.0)
62
+ unicode-display_width (>= 2.4.0, < 3.0)
63
+ rubocop-ast (1.24.1)
64
64
  parser (>= 3.1.1.0)
65
- rubocop-performance (1.15.0)
65
+ rubocop-performance (1.15.2)
66
66
  rubocop (>= 1.7.0, < 2.0)
67
67
  rubocop-ast (>= 0.4.0)
68
- rubocop-rspec (2.15.0)
68
+ rubocop-rspec (2.17.0)
69
69
  rubocop (~> 1.33)
70
70
  ruby-progressbar (1.11.0)
71
71
  simplecov (0.21.2)
@@ -74,11 +74,11 @@ GEM
74
74
  simplecov_json_formatter (~> 0.1)
75
75
  simplecov-html (0.12.3)
76
76
  simplecov_json_formatter (0.1.4)
77
- stringio (3.0.2)
78
- time (0.2.0)
77
+ stringio (3.0.4)
78
+ time (0.2.1)
79
79
  date
80
- unicode-display_width (2.3.0)
81
- uri (0.11.0)
80
+ unicode-display_width (2.4.2)
81
+ uri (0.12.0)
82
82
  vcr (6.1.0)
83
83
  webmock (3.18.1)
84
84
  addressable (>= 2.8.0)
data/README.md CHANGED
@@ -61,15 +61,15 @@ gem 'astrological_forecast'
61
61
  ``` rb
62
62
  require 'astrological_forecast'
63
63
 
64
- AstrologicalForecast.predict
64
+ AstrologicalForecast.predict(true)
65
65
 
66
66
  # Или, если не хотите использовать консоль для ввода данных:
67
67
 
68
- AstrologicalForecast.predict('19.05', 'общий', 'на сегодня')
68
+ AstrologicalForecast.predict(true, '19.05', 'общий', 'на сегодня')
69
69
 
70
70
  ```
71
71
 
72
- ## Запуск (версия с вводом данных в консоли):
72
+ ## Запуск (версия с вводом прогноза в консоль):
73
73
 
74
74
  ``` rb
75
75
  ruby name_programm.rb
@@ -115,6 +115,17 @@ ruby name_programm.rb
115
115
  комфортной. Стоит подумать о том, чтобы выйти из нее раньше, чем это случится.
116
116
  ```
117
117
 
118
+ ## Запуск (версия БЕЗ вывода прогноза в консоль):
119
+
120
+ ``` rb
121
+ require 'astrological_forecast'
122
+
123
+ astro = AstrologicalForecast.predict(false, '19.05', 'общий', 'на сегодня')
124
+
125
+ # astro.class -> Hash
126
+ ```
127
+
128
+
118
129
  ## Помочь в разработке:
119
130
 
120
131
  Шлите ваши пулреквесты в https://github.com/ProfessorNemo/astrological_forecast.
@@ -30,7 +30,7 @@ module AstrologicalForecast
30
30
  def definition_sign_hands
31
31
  raise IncorrectDate unless @date.match?(/\A(\d{2})\.(\d{2})\z/)
32
32
 
33
- @date
33
+ AstrologicalForecast::Facts.sign_identification(sign, @date)
34
34
  end
35
35
  end
36
36
  end
@@ -23,16 +23,18 @@ module AstrologicalForecast
23
23
 
24
24
  class << self
25
25
  def give_types
26
- TYPES.keys.each(&:to_sym).each_with_index do |type, index|
27
- puts "#{index + 1}. #{type}"
26
+
27
+ TYPES.each_with_index do |type, index|
28
+
29
+ puts "#{index + 1}. #{type[0]}"
28
30
  end
29
31
  puts
30
32
  print '> '
31
33
  end
32
34
 
33
35
  def give_period
34
- PERIOD.keys.each(&:to_sym).each_with_index do |period, index|
35
- puts "#{index + 1}. #{period}"
36
+ PERIOD.each_with_index do |period, index|
37
+ puts "#{index + 1}. #{period[0]}"
36
38
  end
37
39
  puts
38
40
  print '> '
@@ -7,6 +7,7 @@ module AstrologicalForecast
7
7
  @signs = params[:signs]
8
8
  @user_type = params[:user_type]
9
9
  @user_period = params[:user_period]
10
+ @console = params[:console]
10
11
  end
11
12
 
12
13
  # получение прогноза
@@ -18,8 +19,8 @@ module AstrologicalForecast
18
19
  { number: @definition['number'],
19
20
  name_ru: @definition['sign_ru'],
20
21
  name_en: @signs.keys[@definition['number'].to_i - 1],
21
- type: AstrologicalForecast::Facts::TYPES[AstrologicalForecast::Facts::TYPES.keys.each(&:to_sym)[@user_type - 1]],
22
- time: AstrologicalForecast::Facts::PERIOD[AstrologicalForecast::Facts::PERIOD.keys.each(&:to_sym)[@user_period - 1]] }
22
+ type: AstrologicalForecast::Facts::TYPES[AstrologicalForecast::Facts::TYPES.each_key(&:to_sym)[@user_type - 1]],
23
+ time: AstrologicalForecast::Facts::PERIOD[AstrologicalForecast::Facts::PERIOD.each_key(&:to_sym)[@user_period - 1]] }
23
24
 
24
25
  begin
25
26
  intro = AstrologicalForecast::Introduction.init(vars)
@@ -29,7 +30,9 @@ module AstrologicalForecast
29
30
  abort e.message
30
31
  end
31
32
 
32
- forecast_results(intro, prediction)
33
+ return forecast_results(intro, prediction) if @console
34
+
35
+ intro.merge prediction
33
36
  end
34
37
 
35
38
  def forecast_results(intro, prediction)
@@ -63,7 +63,7 @@ module AstrologicalForecast
63
63
 
64
64
  # Проверка на корректность заданного типа прогноза и периода прогнозирования
65
65
  def manual_check(opt, const, error)
66
- types = const.each_with_index.each_with_object({}) do |(var, i), result|
66
+ types = const.each_with_index.with_object({}) do |(var, i), result|
67
67
  result[var[0]] = i + 1
68
68
  end
69
69
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AstrologicalForecast
4
- VERSION = '1.3.5'
4
+ VERSION = '2.0.2'
5
5
  end
@@ -6,7 +6,7 @@ require_relative 'main'
6
6
  BASE_URL = 'https://orakul.com/'
7
7
 
8
8
  module AstrologicalForecast
9
- def self.predict(date = nil, type = nil, period = nil)
9
+ def self.predict(console = false, date = nil, type = nil, period = nil)
10
10
  determinant = AstrologicalForecast::DefinitionSign.new(date: date)
11
11
 
12
12
  characteristic = AstrologicalForecast::Type.new(type: type, period: period)
@@ -15,7 +15,8 @@ module AstrologicalForecast
15
15
  definition: determinant.definition,
16
16
  signs: determinant.signs,
17
17
  user_type: characteristic.user_type,
18
- user_period: characteristic.user_period
18
+ user_period: characteristic.user_period,
19
+ console: console
19
20
  }
20
21
 
21
22
  forecast = AstrologicalForecast::Forecast.new(params)
@@ -23,3 +24,6 @@ module AstrologicalForecast
23
24
  forecast.data_forecast
24
25
  end
25
26
  end
27
+
28
+ # AstrologicalForecast.predict(true, '19.05', 'общий', 'на сегодня')
29
+ # AstrologicalForecast.predict(true)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: astrological_forecast
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.5
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb V. Zhegulin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-23 00:00:00.000000000 Z
11
+ date: 2023-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable