class JarvisbotSongfinder::Query

Responsible for selecting concrete query and delegating track methods to it

Query.new("Paramore - Decode").title
# => "Decode"

Constants

URL_REGEX

Attributes

concrete_query[R]

Public Class Methods

new(input, config: JarvisbotSongfinder.configuration) click to toggle source
# File lib/jarvisbot_songfinder/helpers/query.rb, line 16
def initialize(input, config: JarvisbotSongfinder.configuration)
  @config = config
  @input = input
  @concrete_query = select_concrete_query
end

Private Instance Methods

select_concrete_query() click to toggle source
# File lib/jarvisbot_songfinder/helpers/query.rb, line 38
def select_concrete_query
  @input.match?(URL_REGEX) ? UrlQuery.new(@input, config: @config) : SearchQuery.new(@input, config: @config)
end
track() click to toggle source
# File lib/jarvisbot_songfinder/helpers/query.rb, line 34
def track
  @concrete_query.track
end