doc = Nokogiri::HTML('<body><span class="title">Название:</span> Rising Water - James Vincent McMorrow<span></span><body>')
name = doc.xpath('//span/following-sibling::text()[1]').text
p name # => " Rising Water - James Vincent McMorrow"
klass = params[:commentable_type].capitalize.constantize
klass.comments.create(comments_params)
Dump your database
Drop your database,
Create new database with the different encoding
Reload your data.
Make sure the client encoding is set correctly during all this.
obj.your_method { |item| ... }
def your_method(..., ..., &block)
block.call(:somth)
end
# File actionview/lib/action_view/helpers/tag_helper.rb, line 103
def content_tag(name, content_or_options_with_block = nil, options = nil, escape = true, &block)
if block_given?
options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)
content_tag_string(name, capture(&block), options, escape)
else
content_tag_string(name, content_or_options_with_block, options, escape)
end
end
# File actionview/lib/action_view/helpers/capture_helper.rb, line 36
def capture(*args)
value = nil
buffer = with_output_buffer { value = yield(*args) }
if string = buffer.presence || value and string.is_a?(String)
ERB::Util.html_escape string
end
end
cell = {number: 1, color: :red, parity: odd, size: small, dozen: 1, sixline: 1, corner: 1, street: 1, split: 1}
# соответственно для всех видов ставок
# ставим на пару с единицей (на границу 1 и 2) - шанс выигрыша = 17 к 1
bet = {number: nil, color: nil, parity: nil, size: nil, dozen: nil, sixline: nil, corner: nil, street: nil, split: 1}
def match?(cell, bet) do
!cell.keys.all?{|key| cell[key] != bet[key]}
end