Class: Sunniesnow::Chart
- Inherits:
-
Object
- Object
- Sunniesnow::Chart
- Defined in:
- lib/sscharter/chart.rb
Overview
Constant Summary collapse
- SCHEMA =
The schema URL for the output JSON. This will be set as the ‘$schema` property in the generated JSON.
'https://sunniesnow.github.io/schema/chart-1.0.json'
Instance Attribute Summary collapse
-
#artist ⇒ Object
Returns the value of attribute artist.
-
#charter ⇒ Object
Returns the value of attribute charter.
-
#difficulty ⇒ Object
Returns the value of attribute difficulty.
-
#difficulty_color ⇒ Object
Returns the value of attribute difficulty_color.
-
#difficulty_name ⇒ Object
Returns the value of attribute difficulty_name.
-
#difficulty_sup ⇒ Object
Returns the value of attribute difficulty_sup.
-
#events ⇒ Object
readonly
An array of Sunniesnow::Event.
-
#title ⇒ Object
The title of the music.
Instance Method Summary collapse
-
#initialize(live_reload_port: 31108, production: false) ⇒ Chart
constructor
A new instance of Chart.
-
#to_json(*args) ⇒ Object
Convert to JSON.
Constructor Details
#initialize(live_reload_port: 31108, production: false) ⇒ Chart
Returns a new instance of Chart.
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/sscharter/chart.rb', line 40 def initialize live_reload_port: 31108, production: false @title = '' @artist = '' @charter = '' @difficulty_name = '' @difficulty_color = '#000000' @difficulty = '' @difficulty_sup = '' @events = [] @live_reload_port = live_reload_port @production = production end |
Instance Attribute Details
#artist ⇒ Object
Returns the value of attribute artist.
24 25 26 |
# File 'lib/sscharter/chart.rb', line 24 def artist @artist end |
#charter ⇒ Object
Returns the value of attribute charter.
25 26 27 |
# File 'lib/sscharter/chart.rb', line 25 def charter @charter end |
#difficulty ⇒ Object
Returns the value of attribute difficulty.
28 29 30 |
# File 'lib/sscharter/chart.rb', line 28 def difficulty @difficulty end |
#difficulty_color ⇒ Object
Returns the value of attribute difficulty_color.
27 28 29 |
# File 'lib/sscharter/chart.rb', line 27 def difficulty_color @difficulty_color end |
#difficulty_name ⇒ Object
Returns the value of attribute difficulty_name.
26 27 28 |
# File 'lib/sscharter/chart.rb', line 26 def difficulty_name @difficulty_name end |
#difficulty_sup ⇒ Object
Returns the value of attribute difficulty_sup.
29 30 31 |
# File 'lib/sscharter/chart.rb', line 29 def difficulty_sup @difficulty_sup end |
#events ⇒ Object (readonly)
An array of Sunniesnow::Event.
32 33 34 |
# File 'lib/sscharter/chart.rb', line 32 def events @events end |
#title ⇒ Object
The title of the music. This is one of the metadata of the chart which will be reflected in the generated JSON. Also, see chart file specifications for more info.
22 23 24 |
# File 'lib/sscharter/chart.rb', line 22 def title @title end |
Instance Method Details
#to_json(*args) ⇒ Object
Convert to JSON. A Sunniesnow chart is always a JSON file in the level file. This method is used to generate that JSON file.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/sscharter/chart.rb', line 57 def to_json *args hash = { '$schema': SCHEMA, title: @title, artist: @artist, charter: @charter, difficultyName: @difficulty_name, difficultyColor: @difficulty_color, difficulty: @difficulty, difficultySup: @difficulty_sup, events: @events } hash[:sscharter] = { version: Sunniesnow::Charter::VERSION, port: @live_reload_port } unless @production hash.to_json *args end |