Skip to content

Commit fcc248a

Browse files
committed
fix crystal format
1 parent 1078214 commit fcc248a

16 files changed

+228
-225
lines changed

src/m3u8/byte_range.cr

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module M3U8
3636
#
3737
# Examples:
3838
#
39-
# ```crystal
39+
# ```
4040
# ByteRange.parse(ByteRange.new(length: 4500, start: 600))
4141
# ByteRange.parse({length: 4500, start: 600})
4242
# ByteRange.parse("4500@600")
@@ -55,7 +55,7 @@ module M3U8
5555
#
5656
# Examples:
5757
#
58-
# ```crystal
58+
# ```
5959
# ByteRange.new("4500@600")
6060
# ByteRange.new("4500")
6161
# ```
@@ -70,7 +70,7 @@ module M3U8
7070
#
7171
# Examples:
7272
#
73-
# ```crystal
73+
# ```
7474
# options = {length: 4500, start: 600}
7575
# ByteRange.new(options)
7676
# ByteRange.new(length: 4500, start: 600)
@@ -86,7 +86,7 @@ module M3U8
8686
#
8787
# Example:
8888
#
89-
# ```crystal
89+
# ```
9090
# ByteRange.new
9191
# ```
9292
def initialize(@length = nil, @start = nil)
@@ -98,13 +98,13 @@ module M3U8
9898
#
9999
# Examples:
100100
#
101-
# ```crystal
101+
# ```
102102
# byterange = ByteRange.new
103-
# byterange.empty? # => true
103+
# byterange.empty? # => true
104104
# byterange = ByteRange.new(length: 0)
105-
# byterange.empty? # => true
105+
# byterange.empty? # => true
106106
# byterange.length = 4500
107-
# byterange.empty? # => false
107+
# byterange.empty? # => false
108108
# ```
109109
def empty?
110110
length = @length
@@ -118,13 +118,13 @@ module M3U8
118118
#
119119
# Examples:
120120
#
121-
# ```crystal
121+
# ```
122122
# byterange = ByteRange.new(length: 4500, start: 600)
123-
# byterange.to_s # => "4500@600"
123+
# byterange.to_s # => "4500@600"
124124
# byterange = ByteRange.new(length: 4500)
125-
# byterange.to_s # => "4500"
125+
# byterange.to_s # => "4500"
126126
# byterange = ByteRange.new
127-
# byterange.to_s # => ""
127+
# byterange.to_s # => ""
128128
# ```
129129
def to_s
130130
attributes.join('@')
@@ -136,10 +136,10 @@ module M3U8
136136
#
137137
# Example:
138138
#
139-
# ```crystal
139+
# ```
140140
# left = ByteRange.new(length: 4500, start: 600)
141141
# right = "4500@600"
142-
# left == right # => true
142+
# left == right # => true
143143
# ```
144144
def ==(other : String)
145145
to_s == other
@@ -152,10 +152,10 @@ module M3U8
152152
#
153153
# Example:
154154
#
155-
# ```crystal
155+
# ```
156156
# left = ByteRange.new(length: 4500, start: 600)
157157
# right = {length: 4500, start: 600}
158-
# left == right # => true
158+
# left == right # => true
159159
# ```
160160
def ==(other : NamedTuple)
161161
to_s == ByteRange.new(other).to_s
@@ -167,10 +167,10 @@ module M3U8
167167
#
168168
# Example:
169169
#
170-
# ```crystal
170+
# ```
171171
# left = ByteRange.new(length: 4500, start: 600)
172172
# right = ByteRange.new(length: 4500, start: 600)
173-
# left == right # => true
173+
# left == right # => true
174174
# ```
175175
def ==(other : ByteRange)
176176
to_s == other.to_s

src/m3u8/codecs.cr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ module M3U8
108108
#
109109
# Examples:
110110
#
111-
# ```crystal
112-
# options = { audio_codec: "aac-lc" }
111+
# ```
112+
# options = {audio_codec: "aac-lc"}
113113
# Codecs.new(options)
114114
# Codecs.new(audio_codec: "aac-lc")
115115
# ```
@@ -133,7 +133,7 @@ module M3U8
133133
#
134134
# Example:
135135
#
136-
# ```crystal
136+
# ```
137137
# Codecs.new
138138
# ```
139139
def initialize(@codecs = nil,
@@ -151,7 +151,7 @@ module M3U8
151151
#
152152
# Examples:
153153
#
154-
# ```crystal
154+
# ```
155155
# Codecs.new(codecs: "test").to_s # => "test"
156156
# Codecs.new(audio_codec: "aac-lc").to_s # => "mp4a.40.2"
157157
# Codecs.new(profile: "baseline", level: 3.0, audio_codec: "mp3").to_s # => "avc1.66.30,mp4a.40.34"
@@ -194,10 +194,10 @@ module M3U8
194194
#
195195
# Example:
196196
#
197-
# ```crystal
197+
# ```
198198
# left = Codecs.new(audio_codec: "aac-lc")
199199
# right = Codecs.new(audio_codec: "aac-lc")
200-
# left == right # => true
200+
# left == right # => true
201201
# ```
202202
def ==(other : Codecs)
203203
to_s == other.to_s
@@ -209,10 +209,10 @@ module M3U8
209209
#
210210
# Example:
211211
#
212-
# ```crystal
212+
# ```
213213
# left = Codecs.new(audio_codec: "aac-lc")
214214
# right = "aac-lc"
215-
# left == right # => true
215+
# left == right # => true
216216
# ```
217217
def ==(other : String)
218218
to_s == other

src/m3u8/concern.cr

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ module M3U8
2020
#
2121
# Example:
2222
#
23-
# ```crystal
23+
# ```
2424
# include Concern
25-
# parse_attributes("Key=Value") # => {"Key" => "Value"}
25+
# parse_attributes("Key=Value") # => {"Key" => "Value"}
2626
# parse_attributes("Key=\"Quoted Value\"") # => {"Key" => "Quoted Value"}
2727
# ```
2828
private def parse_attributes(line : String)
@@ -40,13 +40,13 @@ module M3U8
4040
#
4141
# Example:
4242
#
43-
# ```crystal
43+
# ```
4444
# include Concern
4545
# options = {
4646
# "X-CUSTOM" => "Client Attributes",
47-
# "CUSTOM" => "Not Client Attributes",
47+
# "CUSTOM" => "Not Client Attributes",
4848
# }
49-
# parse_client_attributes(options) # => {"X-CUSTOM" => "Client Attributes"}
49+
# parse_client_attributes(options) # => {"X-CUSTOM" => "Client Attributes"}
5050
# ```
5151
private def parse_client_attributes(attributes : Hash?)
5252
hash = ClientAttributeType.new
@@ -78,7 +78,7 @@ module M3U8
7878
#
7979
# Example:
8080
#
81-
# ```crystal
81+
# ```
8282
# include Concern
8383
# parse_token("42") # => 42
8484
# parse_token("42.3") # => 42.3
@@ -109,14 +109,14 @@ module M3U8
109109
#
110110
# Examples:
111111
#
112-
# ```crystal
113-
# parse_resolution("1280.0x720.0") # => {width: 1280, height: 720}
114-
# parse_resolution("1280x720") # => {width: 1280, height: 720}
115-
# parse_resolution("1280") # => {width: 1280, height: nil}
116-
# parse_resolution("axb") # => {width: nil, height: nil}
117-
# parse_resolution("ab") # => {width: nil, height: nil}
118-
# parse_resolution("") # => {width: nil, height: nil}
119-
# parse_resolution(nil) # => {width: nil, height: nil}
112+
# ```
113+
# parse_resolution("1280.0x720.0") # => {width: 1280, height: 720}
114+
# parse_resolution("1280x720") # => {width: 1280, height: 720}
115+
# parse_resolution("1280") # => {width: 1280, height: nil}
116+
# parse_resolution("axb") # => {width: nil, height: nil}
117+
# parse_resolution("ab") # => {width: nil, height: nil}
118+
# parse_resolution("") # => {width: nil, height: nil}
119+
# parse_resolution(nil) # => {width: nil, height: nil}
120120
# ```
121121
private def parse_resolution(resolution : String?)
122122
return {width: nil, height: nil} if resolution.nil?
@@ -126,23 +126,23 @@ module M3U8
126126
# Append an empty string to ensure there are at least two elements.
127127
values.push("")
128128

129-
width = nil
129+
width = nil
130130
height = nil
131131

132132
# Attempt to convert the width part first to an integer.
133133
case values[0]
134-
when .to_i? then width = values[0].to_i
135-
when .to_f? then width = values[0].to_f.to_big_i.to_i
134+
when .to_i? then width = values[0].to_i
135+
when .to_f? then width = values[0].to_f.to_big_i.to_i
136136
end
137137

138138
# Attempt to convert the height part similarly.
139139
case values[1]
140-
when .to_i? then height = values[1].to_i
141-
when .to_f? then height = values[1].to_f.to_big_i.to_i
140+
when .to_i? then height = values[1].to_i
141+
when .to_f? then height = values[1].to_f.to_big_i.to_i
142142
end
143143

144144
{
145-
width: width,
145+
width: width,
146146
height: height,
147147
}
148148
end
@@ -154,10 +154,10 @@ module M3U8
154154
#
155155
# Examples:
156156
#
157-
# ```crystal
158-
# parse_frame_rate("29.97") # => 29.97
159-
# parse_frame_rate("0") # => nil
160-
# parse_frame_rate(nil) # => nil
157+
# ```
158+
# parse_frame_rate("29.97") # => 29.97
159+
# parse_frame_rate("0") # => nil
160+
# parse_frame_rate(nil) # => nil
161161
# ```
162162
private def parse_frame_rate(frame_rate : String?)
163163
return if frame_rate.nil?
@@ -172,10 +172,10 @@ module M3U8
172172
#
173173
# Examples:
174174
#
175-
# ```crystal
176-
# parse_yes_no(true) # => "YES"
177-
# parse_yes_no(false) # => "NO"
178-
# parse_yes_no(nil) # => nil
175+
# ```
176+
# parse_yes_no(true) # => "YES"
177+
# parse_yes_no(false) # => "NO"
178+
# parse_yes_no(nil) # => nil
179179
# ```
180180
private def parse_yes_no(value : Bool?)
181181
case value
@@ -192,22 +192,22 @@ module M3U8
192192
#
193193
# Examples:
194194
#
195-
# ```crystal
196-
# parse_boolean("true") # => true
197-
# parse_boolean("YES") # => true
198-
# parse_boolean("True") # => true
199-
# parse_boolean("false") # => false
200-
# parse_boolean("NO") # => false
201-
# parse_boolean("maybe") # => nil
202-
# parse_boolean(nil) # => nil
195+
# ```
196+
# parse_boolean("true") # => true
197+
# parse_boolean("YES") # => true
198+
# parse_boolean("True") # => true
199+
# parse_boolean("false") # => false
200+
# parse_boolean("NO") # => false
201+
# parse_boolean("maybe") # => nil
202+
# parse_boolean(nil) # => nil
203203
# ```
204204
private def parse_boolean(value : String?)
205205
return nil if value.nil?
206206

207207
case value.downcase
208208
when "true", "yes" then true
209209
when "false", "no" then false
210-
else nil
210+
else nil
211211
end
212212
end
213213

@@ -221,13 +221,13 @@ module M3U8
221221
#
222222
# Suppose a class includes Concern (which defines this macro) but does not define a method `foo`:
223223
#
224-
# ```crystal
224+
# ```
225225
# class Dummy
226226
# include Concern
227227
# end
228228
#
229229
# dummy = Dummy.new
230-
# dummy.foo # => nil (since `foo` is missing, method_missing returns nil)
230+
# dummy.foo # => nil (since `foo` is missing, method_missing returns nil)
231231
# ```
232232
private macro method_missing(call)
233233
nil

src/m3u8/date_range_item.cr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ module M3U8
7070
#
7171
# Examples:
7272
#
73-
# ```crystal
73+
# ```
7474
# text = %(#EXT-X-DATERANGE:ID="test_id",CLASS="test_class",\
7575
# START-DATE="2014-03-05T11:15:00Z",END-DATE="2014-03-05T11:16:00Z",\
7676
# DURATION=60.1,PLANNED-DURATION=59.993,X-CUSTOM=45.3,\
@@ -124,7 +124,7 @@ module M3U8
124124
#
125125
# Examples:
126126
#
127-
# ```crystal
127+
# ```
128128
# options = {
129129
# id: "test_id",
130130
# start_date: "2014-03-05T11:15:00Z",
@@ -174,7 +174,7 @@ module M3U8
174174
#
175175
# Example:
176176
#
177-
# ```crystal
177+
# ```
178178
# DateRangeItem.new
179179
# ```
180180
def initialize(@id = nil, @start_date = nil, @class_name = nil, @end_date = nil, @duration = nil, @planned_duration = nil,
@@ -190,7 +190,7 @@ module M3U8
190190
#
191191
# Example:
192192
#
193-
# ```crystal
193+
# ```
194194
# options = {
195195
# id: "test_id",
196196
# start_date: "2014-03-05T11:15:00Z",

src/m3u8/discontinuity_item.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module M3U8
2121
#
2222
# Example:
2323
#
24-
# ```crystal
24+
# ```
2525
# DiscontinuityItem.new.to_s
2626
# # => "#EXT-X-DISCONTINUITY\n"
2727
# ```

0 commit comments

Comments
 (0)