ast-tdl 0.1.0 → 0.1.1

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +44 -30
  3. data/lib/interval.rb +11 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f80f5ce52b90eddc0e2a1d7500a9cb72266cbb9942b48abe51452fc0e5772ed7
4
- data.tar.gz: '019b6ee3ace2a1bf5075f4eda8bbde0e84fd01ad76edef4c8e449d91feefb6a7'
3
+ metadata.gz: 7e1cae6b9c56c969808cd16ff2d58ec838db46745cf3f6b9b1eb3583536ad93b
4
+ data.tar.gz: '0841bfa32e170d22ec587d027086ce4816a86d8116627c8f365000010ebd224a'
5
5
  SHA512:
6
- metadata.gz: 6c63722d51efd64fe0ec516b3861668ea5a9ba96dbb0b4449822ad7b3b0db96922d73addcc6a69fb28de517a608e13f05ccf57a27f15483f87263a97350feb0d
7
- data.tar.gz: 8696fbc00936ba6fe0a533aa5f70e5745d96ba7b9f189267a7d3b40763262477348fede00c69b5de8a214db99850bce9fcb5b64d12ef339df35a4c0b686f094b
6
+ metadata.gz: 179ff4d41c5e51f81f2298bd6363fdbd58afe24b729274a4fc50eb04ffacb3eec453726da1817f4995c55d9923d5202e15c1083f5a7e762993fb7aab08edba48
7
+ data.tar.gz: 9e644b6a2f48ec60038a31c503a7d65fbfa4cc8bc89c19f8e9f2da31700f6299794eb292f37cfc2df72b05c9c8d92f8beb420f94c779055761d5fabfe9ca154c
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  ast-dsl is intended to be a small DSL for practical definition and description of sports training that can be automatically or manually defined and used in conjunction with Artificial Sport Trainer.
5
5
 
6
6
  ## Feature diagram
7
- ![scheme](https://user-images.githubusercontent.com/73126820/175337865-77344476-b7c8-45d4-bda2-0aca82aebefd.png)
7
+ ![scheme](https://user-images.githubusercontent.com/73126820/177509075-977b2e18-ebb7-40ce-9af9-ed7715717bf3.png)
8
8
 
9
9
  ## Installation
10
10
  $ gem install ast-tdl
@@ -14,40 +14,54 @@ Training Description Language (TDL) is implemented in Ruby. Currently, the descr
14
14
 
15
15
  ## Examples
16
16
  ```ruby
17
- EasyTraining = Ast.build :Monday do
18
- session("Short swimming session today") {
19
- sport :"swim"
20
- info :"Very easy training"
21
- average_heart_rate :"130"
22
- total_duration :"30"
23
- }
24
-
25
- session("Bike ride") {
26
- sport :"bike"
27
- info :"Endurance ride with intervals"
28
- average_heart_rate :"140"
29
- total_duration :"250"
30
- }
31
-
32
- interval("Number 1") {
33
- sport :"swim"
34
- info :"Moderate"
35
- average_heart_rate :"160"
36
- total_duration :"5"
37
- average_heart_rate_rest :"90"
38
- total_duration_rest :"2"
39
- }
17
+ Ast.build('My first training') do
18
+ session('Short swimming session') do
19
+ sport :swim
20
+ info :"Very easy training"
21
+ average_heart_rate :"130"
22
+ total_duration :"30"
23
+ end
24
+
25
+ session('Bike ride') do
26
+ sport :cycling
27
+ info :"Endurance ride with intervals"
28
+ average_heart_rate :"140"
29
+ total_duration :"120"
30
+ end
31
+
32
+ interval('Sample interval') do
33
+ sport :cycling
34
+ info :Moderate
35
+ speed_duration :"5"
36
+ recovery_duration :"5"
37
+ speed_heart_rate :"180"
38
+ recovery_heart_rate :"90"
39
+ repetitions :"10"
40
+ end
40
41
  end
41
42
  ```
42
43
 
43
44
  ### Session
44
45
  ```ruby
45
- session("Short swimming session today") {
46
- sport :"swim"
47
- info :"Very easy training"
48
- average_heart_rate :"130"
49
- total_duration :"30"
50
- }
46
+ session('Bike ride') do
47
+ sport :cycling
48
+ info :"Endurance ride with intervals"
49
+ average_heart_rate :"140"
50
+ total_duration :"120"
51
+ end
52
+ ```
53
+
54
+ ### Interval
55
+ ```ruby
56
+ interval('Sample interval') do
57
+ sport :cycling
58
+ info :Moderate
59
+ speed_duration :"5"
60
+ recovery_duration :"5"
61
+ speed_heart_rate :"180"
62
+ recovery_heart_rate :"90"
63
+ repetitions :"10"
64
+ end
51
65
  ```
52
66
 
53
67
  ## License
data/lib/interval.rb CHANGED
@@ -16,6 +16,7 @@ class Interval
16
16
  @speed_heart_rate = 0
17
17
  @recovery_heart_rate = 0
18
18
  @repetitions = 0
19
+ @type = ''
19
20
  end
20
21
 
21
22
  ##
@@ -74,6 +75,14 @@ class Interval
74
75
  @repetitions = repetitions.to_s.to_i
75
76
  end
76
77
 
78
+ ##
79
+ # Adding an interval type to the object.
80
+ # Params:
81
+ # +type+:: interval type
82
+ def type(type)
83
+ @type = type
84
+ end
85
+
77
86
  ##
78
87
  # Converting an interval to a string.
79
88
  def to_s
@@ -91,7 +100,8 @@ class Interval
91
100
  recovery_duration: @recovery_duration,
92
101
  speed_heart_rate: @speed_heart_rate,
93
102
  recovery_heart_rate: @recovery_heart_rate,
94
- repetitions: @repetitions
103
+ repetitions: @repetitions,
104
+ type: @type
95
105
  }
96
106
 
97
107
  hash[:info] = @info if @info
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ast-tdl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - firefly-cpp
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-07-05 00:00:00.000000000 Z
12
+ date: 2022-07-07 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: