Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML require 'rubygems' require 'open-uri' require 'iconv' require 'nokogiri' $KCODE = 'u' class Habr attr_accessor :user, :uid def initialize (user) @user = user @uid = get_uid end def get (url) Nokogiri::HTML( open (url)) end def get_uid html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div.karma-holder" )[ 0 ].get_attribute( 'id' ) end def get_rating result = [] html = get ( "http://#{@user}.habrahabr.ru" ) html.css( "div[@id='#{@uid}']" ).each{|el| result << el.css( 'span.mark' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'span.number' )[ 0 ].content. gsub !( ',' , '.' ).to_f result << el.css( 'dd.total' )[ 0 ].content.to_i } result end def get_posts result = [] html = get ( "http://#{@user}.habrahabr.ru/blog/" ) html.css( "div[@id='main-content'] a.topic" ).each{|el| result << { :title => el.content, :url => el.attribute( 'href' ) } } result end end
Copy Source | Copy HTML
- info = Habr. new ( 'tenkoff' )
- p info.get_rating
- p info.get_posts
Copy Source | Copy HTML
- proxy = proxy. new (ProxedClass.new)
Copy Source | Copy HTML
- class proxy
- def initialize (obj)
- @ class = obj || self
- end
- def method_missing (name, * args, & block)
- p "before ## {name}"
- result = @ class .send name, * args, & block
- p "after ## {name}"
- result
- end
- end
Copy Source | Copy HTML
- info = proxy. new (Habr. new ( 'tenkoff' ))
- p info.get_rating
- p info.get_posts
Copy Source | Copy HTML
- class proxy
- def initialize (obj = '' )
- @ class = obj || self
- end
- def method_missing (name, * args, & block)
- p "before ## {name}"
- result = @ class .send name, * args, & block
- p "after ## {name}"
- result
- end
- def self .method_added (method)
- if self .public_method_defined? method
- private method
- end
- end
- end
Copy Source | Copy HTML
- def initialize (user)
- @user = user
- @uid = get_uid
- super ( self )
- end
Copy Source | Copy HTML
- irb (main): 001 : 0 > Kernel .send: print , 'hello world'
- hello world => nil
Source: https://habr.com/ru/post/53888/
All Articles