time complexityMon, 06 Mar 2023

def body_splited_by_paywall if body_editor == 'verstka' paywall_placeholder = Nokogiri::HTML(body).css('[data-anchor-value="paywall"]').first Nokogiri::HTML.fragment(%( #{body.split(paywall_placeholder.to_s)[0]} #{Grid::Core::Post::PAYWALL_PLACEHOLDER} )).to_html else if body.include?(Grid::Core::Post::PAYWALL_PLACEHOLDER) Nokogiri::HTML.fragment(%( #{body.split(Grid::Core::Post::PAYWALL_PLACEHOLDER)[0]} #{Grid::Core::Post::PAYWALL_PLACEHOLDER} )).to_html else body end end end

O(1)

Questions about programming?Chat with your personal AI assistant