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
$schemaproperty in the generated JSON. 'https://sunniesnow.github.io/schema/chart-1.0.json'
Instance Attribute Summary collapse
-
#artist ⇒ String
The artist of the music.
-
#charter ⇒ String
The author of the chart.
-
#difficulty ⇒ String
The difficulty of the chart.
-
#difficulty_color ⇒ String
The difficulty color of the chart.
-
#difficulty_name ⇒ String
The difficulty name of the chart.
-
#difficulty_sup ⇒ String
The difficulty superscript of the chart.
- #events ⇒ Array<Sunniesnow::Event> readonly
-
#title ⇒ String
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) ⇒ String
Convert to JSON.
Constructor Details
#initialize(live_reload_port: 31108, production: false) ⇒ Chart
Returns a new instance of Chart.
82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/sscharter/chart.rb', line 82 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 ⇒ String
The artist 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.
31 32 33 |
# File 'lib/sscharter/chart.rb', line 31 def artist @artist end |
#charter ⇒ String
The author of the chart. 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.
39 40 41 |
# File 'lib/sscharter/chart.rb', line 39 def charter @charter end |
#difficulty ⇒ String
The difficulty of the chart. 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.
63 64 65 |
# File 'lib/sscharter/chart.rb', line 63 def difficulty @difficulty end |
#difficulty_color ⇒ String
The difficulty color of the chart. 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.
55 56 57 |
# File 'lib/sscharter/chart.rb', line 55 def difficulty_color @difficulty_color end |
#difficulty_name ⇒ String
The difficulty name of the chart. 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.
47 48 49 |
# File 'lib/sscharter/chart.rb', line 47 def difficulty_name @difficulty_name end |
#difficulty_sup ⇒ String
The difficulty superscript of the chart. 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.
71 72 73 |
# File 'lib/sscharter/chart.rb', line 71 def difficulty_sup @difficulty_sup end |
#events ⇒ Array<Sunniesnow::Event> (readonly)
74 75 76 |
# File 'lib/sscharter/chart.rb', line 74 def events @events end |
#title ⇒ String
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.
23 24 25 |
# File 'lib/sscharter/chart.rb', line 23 def title @title end |
Instance Method Details
#to_json(*args) ⇒ String
Convert to JSON. A Sunniesnow chart is always a JSON file in the level file. This method is used to generate that JSON file.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/sscharter/chart.rb', line 99 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 |