Ruby
- 8 ответов
- 0 вопросов
5
Вклад в тег
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"
a = {'a'=>'n'}
a.to_json #=> Валидная строка в формате json
class MyHash < Hash
def foo_value?
has_value? 'foo'
end
end
a = MyHash.new
a[:a] = 'foo'
b = MyHash.new
b[:a] = 'baz'
p a.foo_value?
p b.foo_value?
$.ajax({
url: 'https://api.vk.com/method/database.getCities?',
data: {
country_id: "1",
q: "Санкт"
},
type: 'GET',
dataType: 'jsonp',
success: function(data) {
console.log(data.response[0])
}
})
a = 'sea'
URI("https://music.yandex.ru/search?text=#{a}")
#=> #<URI::HTTPS https://music.yandex.ru/search?text=sea>
uri = URI('https://music.yandex.ru/search')
params = { :text => 'пятница' }
uri.query = URI.encode_www_form(params)
res = Net::HTTP.get_response(uri)