Module: MaimaiNet::Page::TrackHelper
- Defined in:
- lib/maimai_net/page-html_helper.rb
Instance Method Summary collapse
- #get_chart_buddy_flag_from(node) ⇒ 0, 1
-
#get_chart_difficulty_from(node) ⇒ Constants::Difficulty
Difficulty value of given html element.
-
#get_chart_level_text_from(node) ⇒ String
Normalized difficulty text.
- #get_chart_type_from(node) ⇒ String, "unknown"
- #get_chart_variant_from(node) ⇒ String?
Instance Method Details
#get_chart_buddy_flag_from(node) ⇒ 0, 1
118 119 120 |
# File 'lib/maimai_net/page-html_helper.rb', line 118 def get_chart_buddy_flag_from(node) node&.at_css('img[src*="music_utage_buddy.png"]').nil? ? 0 : 1 end |
#get_chart_difficulty_from(node) ⇒ Constants::Difficulty
Returns difficulty value of given html element.
90 91 92 |
# File 'lib/maimai_net/page-html_helper.rb', line 90 def get_chart_difficulty_from(node) Difficulty(subpath_from(node)) end |
#get_chart_level_text_from(node) ⇒ String
Returns normalized difficulty text.
95 96 97 |
# File 'lib/maimai_net/page-html_helper.rb', line 95 def get_chart_level_text_from(node) strip(node).sub(/\?$/, '') end |
#get_chart_type_from(node) ⇒ String, "unknown"
101 102 103 104 105 |
# File 'lib/maimai_net/page-html_helper.rb', line 101 def get_chart_type_from(node) return -'unknown' if node.nil? subpath_from(node) end |
#get_chart_variant_from(node) ⇒ String?
Note:
this is a semantic clarity for strip function.
111 112 113 114 |
# File 'lib/maimai_net/page-html_helper.rb', line 111 def get_chart_variant_from(node) node&.at_css('img[src*="music_utage.png"]').nil? ? nil : strip(node) end |