{"id":223209,"date":"2014-05-19T14:10:02","date_gmt":"2014-05-19T10:10:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=223209"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=223209","title":{"rendered":"<span class=\"post_title\">Ruby 2.1 \u0432 \u0434\u0435\u0442\u0430\u043b\u044f\u0445 (\u0427\u0430\u0441\u0442\u044c 2)<\/span>"},"content":{"rendered":"<div class=\"content html_format\">       <img decoding=\"async\" align=\"right\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/ccd\/b8f\/bab\/ccdb8fbabd2b13bae6145fa4da9c7ac2.png\"\/>  <\/p>\n<h5>Refinements<\/h5>\n<p>  \u0423\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u044f (refinements) \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0438\u0447\u0435\u0439 \u0438 \u043d\u0435 \u0432\u044b\u0432\u043e\u0434\u044f\u0442 \u0432\u043e\u0440\u043d\u0438\u043d\u0433, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432 \u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0442\u0430\u043b\u0435\u0439, \u0434\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u043c.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043a \u043c\u0435\u0442\u043e\u0434\u0443 #using \u0434\u043b\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0439 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0444\u0430\u0439\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0441\u044f \u043c\u0435\u0442\u043e\u0434 Module#using \u0434\u043b\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043c\u043e\u0434\u0443\u043b\u044f. \u041e\u0434\u043d\u0430\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0439 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e \u043b\u0435\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u044c\u044e \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u0442.\u0435. \u043e\u043d\u0438 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0430\u043a\u0442\u0438\u0432\u043d\u044b \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u044f.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<pre><code class=\"ruby\">module NumberQuery   refine String do     def number?       match(\/\\A(0|-?[1-9][0-9]*)\\z\/) ? true : false     end   end end  module Example   using NumberQuery   &quot;42&quot;.number?   #=&gt; true end  module Example   &quot;42&quot;.number?   #=&gt; #&lt;NoMethodError: undefined method `number?' for &quot;42&quot;:String&gt; end <\/code><\/pre>\n<p>  \u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0439 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 Module#include, \u0442.\u0435. \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u044f, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f\u0445, \u0432 \u043e\u0434\u043d\u043e\u043c \u0438 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432\u0441\u0435, \u0432\u044b\u0437\u044b\u0432\u0430\u044f #using \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f.<\/p>\n<pre><code class=\"ruby\">module BlankQuery   refine Object do     def blank?       respond_to?(:empty?) ? empty? : false     end   end    refine String do     def blank?       strip.length == 0     end   end    refine NilClass do     def blank?       true     end   end end  module NumberQuery   refine Object do     def number?       false     end   end    refine String do     def number?       match(\/\\A(0|-?[1-9][0-9]*)\\z\/) ? true : false     end   end    refine Numeric do     def number?       true     end   end end  module Support   include BlankQuery   include NumberQuery end  class User   using Support   # ...      def points=(obj)     raise &quot;points can't be blank&quot; if obj.blank?     raise &quot;points must be a number&quot; unless obj.number?     @points = obj   end end <\/code><\/pre>\n<h5>String#scrub<\/h5>\n<p>  \u041c\u0435\u0442\u043e\u0434 String#scrub \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0432 Ruby 2.1 \u0434\u043b\u044f \u043f\u043e\u043c\u043e\u0449\u0438 \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u043c\u0438 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0435 \u0431\u0430\u0439\u0442\u044b.<\/p>\n<pre><code class=\"ruby\"># create a string that can't be sensibly printed  # 'latin 1' encoded string with accented character string = &quot;\u00f6ops&quot;.encode(&quot;ISO-8859-1&quot;) # misrepresented as UTF-8 string.force_encoding(&quot;UTF-8&quot;) # and mixed with a UTF-8 character string = &quot;\u00a1#{string}!&quot; <\/code><\/pre>\n<p>  \u0412\u0440\u044f\u0434 \u043b\u0438 \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0441\u043e\u0437\u043d\u0430\u0442\u0435\u043b\u044c\u043d\u043e (\u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u044f \u043d\u0430 \u044d\u0442\u043e \u043d\u0430\u0434\u0435\u044e\u0441\u044c), \u043d\u043e \u0442\u0430\u043a\u043e\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438, \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u0430\u043a\u043e\u0433\u043e \u00ab\u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u044f\u00bb, \u043c\u044b \u0443\u0436\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u0432\u0435\u0440\u043d\u043e \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b, \u043d\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0445\u043e\u0442\u044f \u0431\u044b \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0445:<\/p>\n<pre><code class=\"ruby\"># replace with 'replacement character' string.scrub        #=&gt; &quot;\u00a1\ufffdops!&quot; # delete string.scrub(&quot;&quot;)    #=&gt; &quot;\u00a1ops!&quot; # replace with chosen character string.scrub(&quot;?&quot;)   #=&gt; &quot;\u00a1?ops!&quot; # yield to a block for custom replacement # (in this case the invalid bytes as hex) string.scrub {|bytes| &quot;&lt;#{bytes.unpack(&quot;H*&quot;).join}&gt;&quot;}   #=&gt; &quot;\u00a1&lt;f6&gt;ops!&quot; <\/code><\/pre>\n<p>  \u0422\u043e\u0442 \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0430 #encoding \u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u0438 invalid: :replace \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n<pre><code class=\"ruby\">string.encode(&quot;UTF-8&quot;, invalid: :replace)                 #=&gt; &quot;\u00a1\ufffdops!&quot; string.encode(&quot;UTF-8&quot;, invalid: :replace, replace: &quot;?&quot;)   #=&gt; &quot;\u00a1?ops!&quot; <\/code><\/pre>\n<h5>\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u043a\u043b\u0430\u0441\u0441\u0430\u0445 Bignum\/Rational<\/h5>\n<p>  \u041a\u043b\u0430\u0441\u0441\u044b Bignum \u0438 Rational \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 GNU Multiple Precision Arithmetic Library (GMP) \u0434\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<h5>\u0423\u0434\u0430\u043b\u0435\u043d 4 \u0443\u0440\u043e\u0432\u0435\u043d\u044c $SAFE<\/h5>\n<p>  \u0417\u0430\u0434\u0430\u043d\u0438\u0435 $SAFE = 4 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c Ruby \u0432 \u0440\u0435\u0436\u0438\u043c \u00ab\u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u044b\u00bb \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u043d\u0435 \u0431\u044b\u043b\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c, \u0442.\u043a. \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e \u043d\u0435\u043c\u0430\u043b\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043e\u0434\u0430, \u0440\u0430\u0437\u0431\u0440\u043e\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0443, \u0434\u0430 \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u043e\u0441\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0438 \u0431\u044b\u043b\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u043e.<\/p>\n<pre><code class=\"ruby\">$SAFE = 4   #=&gt; #&lt;ArgumentError: $SAFE=4 is obsolete&gt; <\/code><\/pre>\n<h5>clock_gettime<\/h5>\n<p>  Ruby \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 clock_gettime() \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 Process.clock_gettime, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c \u0434\u0430\u0442\u044b. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0430\u0440\u0433\u043c\u0435\u043d\u0442\u0430 \u043c\u0435\u0442\u043e\u0434\u0443 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f id \u0432\u0440\u0435\u043c\u0435\u043d\u0438:<\/p>\n<pre><code class=\"ruby\">Process.clock_gettime(Process::CLOCK_REALTIME)   #=&gt; 1391705719.906066 <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0434\u0430\u0432 Process::CLOCK_REALTIME, \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043e\u0442\u043c\u0435\u0442\u043a\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 Unix \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041e\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c Time.now.to_f, \u043d\u043e \u0431\u0435\u0437 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Time, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p>\n<p>  Process.clock_gettime \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u00ab\u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u044b\u043c\u00bb \u0447\u0430\u0441\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0447\u0430\u0441\u043e\u0432. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u044b\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u043c\u0435\u0440\u043e\u0432 \u0438\u043b\u0438 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438\u043d\u0433\u0430.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u044b\u0445 \u0447\u0430\u0441\u043e\u0432 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u043e\u0442\u043c\u0435\u0442\u043a\u043e\u0439:<\/p>\n<pre><code class=\"ruby\">start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) sleep 1 Process.clock_gettime(Process::CLOCK_MONOTONIC) - start_time   #=&gt; 1.0051147330086678 <\/code><\/pre>\n<p>  \u0415\u0449\u0435 \u043e\u0434\u043d\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e \u0434\u043b\u044f \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438\u043d\u0433\u0430, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f CLOCK_PROCESS_CPUTIME_ID. \u041e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u044b\u0435 \u0447\u0430\u0441\u044b, \u0442.\u0435. \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 CPU \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043a\u0430\u043a\u0443\u044e-\u043b\u0438\u0431\u043e \u0440\u0430\u0431\u043e\u0442\u0443. \u042d\u0442\u0430 \u043e\u0442\u043c\u0435\u0442\u043a\u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 \u043e\u0442\u043c\u0435\u0442\u043a\u043e\u0439.<\/p>\n<pre><code class=\"ruby\">start_time = Process.clock_gettime(Process::CLOCK_PROCESS_CPUTIME_ID) sleep 1 Process.clock_gettime(Process::CLOCK_PROCESS_CPUTIME_ID) - start_time   #=&gt; 0.005225999999999981 <\/code><\/pre>\n<p>  \u042d\u0442\u0438 \u0442\u0440\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u043e\u0432, \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435, \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u043e\u0435 \u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0435, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432\u0441\u0435\u0433\u0434\u0430. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0432\u0430\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f \u0438 \u043a \u0434\u0440\u0443\u0433\u0438\u043c \u0432\u0438\u0434\u0430\u043c \u0447\u0430\u0441\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u044d\u0442\u043e, \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e <a href=\"http:\/\/ruby-doc.org\/core-2.1.0\/Process.html#method-c-clock_gettime\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a>.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0432\u0438\u0434\u0430 \u0447\u0430\u0441\u043e\u0432, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430.<\/p>\n<pre><code class=\"ruby\">Process.const_defined?(:CLOCK_PROCESS_CPUTIME_ID)   #=&gt; true Process.const_defined?(:CLOCK_THREAD_CPUTIME_ID)    #=&gt; false <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043c\u0435\u0442\u043e\u0434 Process.clock_getres, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0437\u043d\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u0432\u0438\u0434\u043e\u043c \u0447\u0430\u0441\u043e\u0432.<\/p>\n<h5>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 RubyGems<\/h5>\n<p>  \u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f RubyGems \u0431\u044b\u043b\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u0434\u043e \u0432\u0435\u0440\u0441\u0438\u0438 2.2. \u041a <a href=\"http:\/\/globaldev.co.uk\/2013\/03\/ruby-2-0-0-in-detail\/#rubygems-gemfile-support\">\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435 Gemfile<\/a> \u0431\u044b\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 Gemfile.lock, \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e <a href=\"https:\/\/github.com\/jruby\/jruby\/issues\/1146#issuecomment-29714318\">\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435 \u0432\u0441\u0435\u0445 \u0444\u0438\u0447 Bundler&#8217;\u0430 \u0432 RubyGems<\/a>.<\/p>\n<p>  \u041e\u043f\u0446\u0438\u044f &#8212;file(\u0438\u043b\u0438 -g) \u0434\u043b\u044f gem install \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u043e\u043d\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0447\u0435\u0441\u043a\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 Gemfile. gem install \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c Gemfile.lock, \u0435\u0441\u043b\u0438 \u043e\u043d \u0435\u0449\u0435 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u043d, \u0438 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u0438, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0432 \u043d\u0435\u043c, \u0435\u0441\u043b\u0438 \u043e\u043d \u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043d.<\/p>\n<pre><code class=\"bash\">$ ls Gemfile $ gem install -g Fetching: going_postal-0.1.4.gem (100%) Installing going_postal (0.1.4) $ ls Gemfile Gemfile.lock <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0444\u0430\u043b\u0435 <a href=\"https:\/\/github.com\/rubygems\/rubygems\/tree\/master\/History.txt\">History<\/a>.<\/p>\n<h5>\u0423\u0434\u0430\u043b\u0435\u043d\u044b \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0435 \u0444\u0438\u0447\u0438 Rake<\/h5>\n<p>  \u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 Rake \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d \u0434\u043e \u0432\u0435\u0440\u0441\u0438\u0438 10.1.0, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u0434\u0430\u043b\u0435\u043d\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e deprecated-\u0444\u0438\u0447. \u0412 \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0430\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Rake \u0443\u0436\u0435 \u0434\u0430\u0432\u043d\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u044d\u0442\u0438\u0445 \u0444\u0438\u0447, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0431\u044b\u0442\u044c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0435\u0439, \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 Rake \u0432\u0435\u0440\u0441\u0438\u0439 <a href=\"http:\/\/rake.rubyforge.org\/doc\/release_notes\/rake-10_0_3_rdoc.html\">10.0.3<\/a> \u0438 <a href=\"http:\/\/rake.rubyforge.org\/doc\/release_notes\/rake-10_1_0_rdoc.html\">10.1.0<\/a>.<\/p>\n<h5>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 RDoc<\/h5>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432 Ruby \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u044f RDoc \u0432\u0435\u0440\u0441\u0438\u0438 4.1, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u043f\u043b\u0430\u043d\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0444\u0430\u0439\u043b\u0435 <a href=\"https:\/\/github.com\/rdoc\/rdoc\/blob\/1f7cbffaa2192f7088156c51b0962e61f3dc8ad4\/History.rdoc#410--2013-12-26\">History<\/a>.<\/p>\n<h5>\u0418\u043c\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430<\/h5>\n<p>  \u0411\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 Process.setproctitle, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u043c\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0431\u0435\u0437 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 $0. \u0422\u0430\u043a\u0436\u0435 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043c\u0435\u0442\u043e\u0434 Process.argv0 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 $0.<\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u043e\u043d\u043e\u0432\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<pre><code class=\"ruby\">data.each_with_index do |datum, i|   Process.setproctitle(&quot;#{Process.argv0} - job #{i} of #{data.length}&quot;)   process(datum) end <\/code><\/pre>\n<p>  \u0442\u043e\u0433\u0434\u0430 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 ps \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"bash\">$ ps   PID TTY           TIME CMD   339 ttys000    0:00.23 -bash  7321 ttys000    0:00.06 background.rb - job 10 of 30 <\/code><\/pre>\n<h5>\u0417\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u044b\u0439 Symbol<\/h5>\n<p>  \u041e\u0431\u044a\u0435\u043a\u0442\u044b Symbol \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e \u0446\u0435\u043b\u044b\u043c \u0438 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0447\u0438\u0441\u043b\u0430\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u00ab\u0437\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u044b\u0445\u00bb (frozen) \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<pre><code class=\"ruby\">:foo.frozen?                               #=&gt; true :foo.instance_variable_set(:@bar, &quot;baz&quot;)   #=&gt; #&lt;RuntimeError: can't modify frozen Symbol&gt; <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0434\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043c\u0443\u0441\u043e\u0440\u0430 \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Ruby.<\/p>\n<h5>\u0418\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430 \u0443\u0442\u0435\u0447\u043a\u0430 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438<\/h5>\n<p>  \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432 private, protected, public \u0438\u043b\u0438 module_function \u0431\u0435\u0437 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e eval, instance_eval \u0438\u043b\u0438 module_eval, \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 \u00ab\u043f\u0440\u043e\u0442\u0435\u043a\u0430\u0435\u0442\u00bb \u0432 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u0442.\u0435. \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0438\u0436\u0435 \u043c\u0435\u0442\u043e\u0434 foo \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u043c:<\/p>\n<pre><code class=\"ruby\">class Foo   eval &quot;private&quot;      def foo     &quot;foo&quot;   end end <\/code><\/pre>\n<p>  \u0412 \u0432\u0435\u0440\u0441\u0438\u0438 2.1 \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \u0438 foo \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c.<\/p>\n<h5>#untrusted? \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c \u0434\u043b\u044f #tainted?<\/h5>\n<p>  \u0420\u0430\u043d\u0435\u0435 \u0432 Ruby \u0431\u044b\u043b\u043e \u0434\u0432\u0430 \u043d\u0430\u0431\u043e\u0440\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u0435\u0447\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u0430\u043a \u043d\u0435\u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0435, \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 #tainted?, #taint \u0438 #untaint, \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 #untrusted?, #untrust \u0438 #trust. \u041e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0444\u043b\u0430\u0433\u0438 \u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0443\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0438 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0444\u043b\u0430\u0433, \u043f\u0440\u0438\u0447\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f #tainted? \u0438 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f, \u0430 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 #untrusted? \u0438 \u0434\u0440. \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0432\u043e\u0440\u043d\u0438\u043d\u0433\u0438.<\/p>\n<pre><code class=\"ruby\">string = &quot;foo&quot; string.untrust string.tainted?   #=&gt; true <\/code><\/pre>\n<p>  \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435<\/p>\n<pre><code class=\"ruby\">example.rb:2: warning: untrust is deprecated and its behavior is same as taint <\/code><\/pre>\n<h5>return \u0432 \u043b\u044f\u043c\u0431\u0434\u0430\u0445<\/h5>\n<p>  \u041b\u044f\u043c\u0431\u0434\u044b \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043e\u0442 \u0431\u043b\u043e\u043a\u043e\u0432 \u0438 Proc-\u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0442\u0435\u043c, \u0447\u0442\u043e return \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0437 \u043b\u044f\u043c\u0431\u0434\u044b, \u0430 \u043d\u0435 \u0438\u0437 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0435\u0441\u043b\u0438 \u043b\u044f\u043c\u0431\u0434\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0441 &#038; \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e yield. \u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e.<\/p>\n<pre><code class=\"ruby\">def call_with_yield   yield end  def test   call_with_yield(&lambda {return &quot;hello from lambda&quot;})   &quot;hello from method&quot; end  test   #=&gt; &quot;hello from method&quot; <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0448\u0435 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u00abhello from lambda\u00bb \u0432 Ruby &lt;= 2.0.0.<\/p>\n<h5>\u0410\u0434\u0440\u0435\u0441\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432<\/h5>\n<p>  \u041f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0435\u0442\u0430\u043b\u0438 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 Socket.getifaddrs. \u041e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 Socket::Ifaddr.<\/p>\n<pre><code class=\"ruby\">require &quot;socket&quot;  info = Socket.getifaddrs.find do |ifaddr|   (ifaddr.flags & Socket::IFF_BROADCAST).nonzero? &&     ifaddr.addr.afamily == Socket::AF_INET end  info.addr.ip_address   #=&gt; &quot;10.0.1.2&quot; <\/code><\/pre>\n<h5>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f \u0432 StringScanner<\/h5>\n<p>  StringScanner#[] \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u044b Symbol \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f.<\/p>\n<pre><code class=\"ruby\">require &quot;strscan&quot;  def parse_ini(string)   scanner = StringScanner.new(string)   current_section = data = {}    until scanner.eos?     scanner.skip(\/\\s+\/)     if scanner.scan(\/;\/)       scanner.skip_until(\/[\\r\\n]+\/)     elsif scanner.scan(\/\\[(?&lt;name&gt;[^\\]]+)\\]\/)       current_section = current_section[scanner[:name]] = {}     elsif scanner.scan(\/(?&lt;key&gt;[^=]+)=(?&lt;value&gt;.*)\/)       current_section[scanner[:key]] = scanner[:value]     end   end    data end <\/code><\/pre>\n<h5>YAML.safe_load<\/h5>\n<p>  \u0412 YAML (\u0438\u043b\u0438 \u0442\u043e\u0447\u043d\u0435\u0435 \u0432 Psych, \u043b\u0435\u0436\u0430\u0449\u0438\u0439 \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438) \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043c\u0435\u0442\u043e\u0434 safe_load. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b: TrueClass, FalseClass, NilClass, Numeric, String, Array \u0438 Hash. \u0414\u043b\u044f \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0435\u0441\u043b\u0438 \u0432\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b \u0432 \u0438\u0445 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0438\u0445 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0435\u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0431\u0443\u0436\u0434\u0435\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 Psych::DisallowedClass, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e \u043a\u0430\u043a YAML::DisallowedClass.<\/p>\n<pre><code class=\"ruby\">require &quot;yaml&quot; YAML.safe_load(&quot;:foo: 1&quot;)             #=&gt; #&lt;Psych::DisallowedClass: Tried to load unspecified class: Symbol&gt; YAML.safe_load(&quot;:foo: 1&quot;, [Symbol])   #=&gt; {:foo=&gt;1} <\/code><\/pre>\n<h5>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 MDNS \u0438 LOC \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 Resolv<\/h5>\n<p>  \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Resolv DNS \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u043c\u043d\u043e\u0433\u043e\u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0433\u043e DNS \u043f\u043e\u0438\u0441\u043a\u0430. \u041e\u043d \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u044d\u0442\u043e \u0432\u0435\u0441\u044c\u043c\u0430 \u0443\u0434\u043e\u0431\u043d\u043e\u0435 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 (\u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 DNS Service Discovery \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 <a href=\"http:\/\/rubygems.org\/gems\/dnssd\">\u0433\u0435\u043c dnssd<\/a>).<\/p>\n<pre><code class=\"ruby\">require &quot;resolv&quot;  resolver = Resolv::MDNS.new resolver.getaddress(&quot;example.local&quot;)   #=&gt; #&lt;Resolv::IPv4 10.0.1.2&gt; <\/code><\/pre>\n<p>  \u0421\u0432\u044f\u0437\u043a\u0430 \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 resolv-replace \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u0430 mDNS \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e\u043c \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0432 Ruby.<\/p>\n<pre><code class=\"ruby\">require &quot;resolv-replace&quot; require &quot;net\/http&quot;  Resolv::DefaultResolver.replace_resolvers([Resolv::Hosts.new, Resolv::MDNS.new]) Net::HTTP.get_response(URI.parse(&quot;http:\/\/example.local&quot;))   #=&gt; #&lt;Net::HTTPOK 200 OK readbody=true&gt; <\/code><\/pre>\n<p>  Resolv \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c DNS <a href=\"http:\/\/en.wikipedia.org\/wiki\/LOC_record\">LOC \u0437\u0430\u043f\u0438\u0441\u0438<\/a>.<\/p>\n<pre><code class=\"ruby\">require &quot;resolv&quot;  dns = Resolv::DNS.new  # find.me.uk has LOC records for all UK postcodes resource = dns.getresource(&quot;W1A1AA.find.me.uk&quot;, Resolv::DNS::Resource::IN::LOC)  resource.latitude    #=&gt; #&lt;Resolv::LOC::Coord 51 31 6.827 N&gt; resource.longitude   #=&gt; #&lt;Resolv::LOC::Coord 0 8 37.585 W&gt; <\/code><\/pre>\n<p>  \u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432 Resolv, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f DNS \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 Resolv::DNS#fetch_resource.<\/p>\n<pre><code class=\"ruby\">require &quot;resolv&quot;  dns = Resolv::DNS.new dns.fetch_resource(&quot;example.com&quot;, Resolv::DNS::Resource::IN::A) do |reply, reply_name|   reply        #=&gt; #&lt;Resolv::DNS::Message:0x007f88192e2cc0 @id=55405, @qr=1, @opcode=0, @aa=0, @tc=0, @rd=1, @ra=1, @rcode=0, @question=[[#&lt;Resolv::DNS::Name: example.com.&gt;, Resolv::DNS::Resource::IN::A]], @answer=[[#&lt;Resolv::DNS::Name: example.com.&gt;, 79148, #&lt;Resolv::DNS::Resource::IN::A:0x007f88192e1c80 @address=#&lt;Resolv::IPv4 93.184.216.119&gt;, @ttl=79148&gt;]], @authority=[], @additional=[]&gt;   reply_name   #=&gt; #&lt;Resolv::DNS::Name: example.com.&gt; end <\/code><\/pre>\n<h5>\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 Socket<\/h5>\n<p>  \u0412 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u0431\u044b\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0430\u0434\u0440\u0435\u0441\u0430 \u0441\u043e\u043a\u0435\u0442\u043e\u0432.<\/p>\n<pre><code class=\"ruby\">require &quot;socket&quot;  TCPSocket.new(&quot;localhost&quot;, 8080)   #=&gt; #&lt;Errno::ECONNREFUSED: Connection refused - connect(2) for &quot;localhost&quot; port 8080&gt; <\/code><\/pre>\n<h5>\u0423\u0441\u043a\u043e\u0440\u0435\u043d\u043d\u044b\u0439 Hash#shift<\/h5>\n<p>  \u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c Hash#shift \u0431\u044b\u043b\u0430 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0430, \u0447\u0442\u043e \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u043e\u0439 \u0432\u0441\u0442\u0430\u0432\u043a\u043e\u0439, \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0435\u0439\u0441\u044f \u0432 Ruby 1.9, \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"http:\/\/ru.wikipedia.org\/wiki\/%D0%90%D0%BB%D0%B3%D0%BE%D1%80%D0%B8%D1%82%D0%BC%D1%8B_%D0%BA%D1%8D%D1%88%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F#Least_Recently_Used_.28.D0.92.D1.8B.D1.82.D0.B5.D1.81.D0.BD.D0.B5.D0.BD.D0.B8.D0.B5_.D0.B4.D0.B0.D0.B2.D0.BD.D0.BE_.D0.BD.D0.B5.D0.B8.D1.81.D0.BF.D0.BE.D0.BB.D1.8C.D0.B7.D1.83.D0.B5.D0.BC.D1.8B.D1.85.29\">LRU-\u043a\u044d\u0448<\/a>.<\/p>\n<pre><code class=\"ruby\">class LRUCache   def initialize(size)     @size, @hash = size, {}   end    def [](key)     @hash[key] = @hash.delete(key)   end    def []=(key, value)     @hash.delete(key)     @hash[key] = value     @hash.shift if @hash.size &gt; @size   end end <\/code><\/pre>\n<h5>\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 Queue, SizedQueue \u0438 ConditionVariable<\/h5>\n<p>  \u041a\u043b\u0430\u0441\u0441\u044b Queue, SizedQueue \u0438 ConditionVariable \u0431\u044b\u043b\u0438 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u044b \u0437\u0430\u0441\u0447\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0445 \u043d\u0430 C (\u0440\u0430\u043d\u0435\u0435 \u0431\u044b\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043d\u0430 Ruby).<\/p>\n<h5>\u041f\u0435\u0440\u0435\u0445\u0432\u0430\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 Timeout<\/h5>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u0430\u043b\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 Timeout \u0434\u043b\u044f \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u043b\u043e\u043a\u0430. \u042d\u0442\u043e \u0434\u0435\u0442\u0430\u043b\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 Timeout::Error \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u043d\u044b\u043c \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0447\u0435\u043d\u043e.<\/p>\n<pre><code class=\"ruby\">require &quot;timeout&quot;  begin   Timeout.timeout(1) do     begin       sleep 2     rescue Exception       # no longer swallows the timeout exception     end   end rescue StandardError =&gt; e   e   #=&gt; #&lt;Timeout::Error: execution expired&gt; end <\/code><\/pre>\n<h5>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430<\/h5>\n<p>  \u0412 \u043a\u043b\u0430\u0441\u0441 Set \u0431\u044b\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043c\u0435\u0442\u043e\u0434\u044b #intersect? \u0438 #disjoint?. \u041c\u0435\u0442\u043e\u0434 #intersect? \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 true, \u0435\u0441\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0438\u043c\u0435\u044e\u0442 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u043e\u0431\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438 false \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, #disjoint? \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442.<\/p>\n<pre><code class=\"ruby\">require &quot;set&quot;  a = Set[1,2,3] b = Set[3,4,5] c = Set[4,5,6]  a.intersect?(b)   #=&gt; true b.intersect?(c)   #=&gt; true a.intersect?(c)   #=&gt; false  a.disjoint?(b)   #=&gt; false b.disjoint?(c)   #=&gt; false a.disjoint?(c)   #=&gt; true  <\/code><\/pre>\n<p>  \u0414\u0440\u0443\u0433\u0438\u043c \u0432\u0430\u0436\u043d\u044b\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0432 Set \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u043c\u0435\u0442\u043e\u0434 #to_set \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u0430\u043c \u043e\u0431\u044a\u0435\u043a\u0442, \u0430 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u043a\u043e\u043f\u0438\u044e.<\/p>\n<pre><code class=\"ruby\">require &quot;set&quot;  set = Set[&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;] set.object_id          #=&gt; 70286489985620 set.to_set.object_id   #=&gt; 70286489985620 <\/code><\/pre>\n<h5>\u0423\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 WEBrick<\/h5>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0442\u0435\u043b\u043e HTTP \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 WEBrick \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043e \u043b\u044e\u0431\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 #read \u0438 #readpartial. \u0420\u0430\u043d\u0435\u0435 \u044d\u0442\u043e \u043c\u043e\u0433\u043b\u0438 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u044b IO \u0438\u043b\u0438 String. \u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0438\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043a\u043b\u0430\u0441\u0441, \u0432\u044b\u0432\u043e\u0434\u044f\u0449\u0438\u0439 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u043a\u0430\u0436\u0434\u0443\u044e \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 10 \u0441\u0435\u043a\u0443\u043d\u0434.<\/p>\n<pre><code class=\"ruby\">require &quot;webrick&quot;  class EnumeratorIOAdapter   def initialize(enum)     @enum, @buffer, @more = enum, &quot;&quot;, true   end    def read(length=nil, out_buffer=&quot;&quot;)     return nil unless @more     until (length && @buffer.length &gt;= length) || !fill_buffer; end     if length       part = @buffer.slice!(0, length)     else       part, @buffer = @buffer, &quot;&quot;     end     out_buffer.replace(part)   end    def readpartial(length, out_buffer=&quot;&quot;)     raise EOFError if @buffer.empty? && !fill_buffer     out_buffer.replace(@buffer.slice!(0, length))   end    private   def fill_buffer     @buffer &lt;&lt; @enum.next   rescue StopIteration     @more = false   end end  server = WEBrick::HTTPServer.new(Port: 8080)  server.mount_proc &quot;\/&quot; do |request, response|   enum = Enumerator.new do |yielder|     10.times do       sleep 1       yielder &lt;&lt; &quot;#{Time.now}\\r\\n&quot;     end   end    response.chunked = true   response.body = EnumeratorIOAdapter.new(enum) end  trap(:INT) {server.shutdown} server.start <\/code><\/pre>\n<h5>Numeric#step<\/h5>\n<p>  \u041c\u0435\u0442\u043e\u0434 #step \u043a\u043b\u0430\u0441\u0441\u0430 Numeric \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b by: \u0438 to:. \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 to: \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u0435\u0441\u043b\u0438 \u043e\u043d \u043d\u0435 \u0437\u0430\u0434\u0430\u043d, \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439. \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0430\u0440\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0438\u0447\u044c, \u0443\u043a\u0430\u0437\u0430\u0432 nil \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430.<\/p>\n<pre><code class=\"ruby\">0.step(by: 5, to: 20) do |i|   puts i end <\/code><\/pre>\n<p>  \u0432\u044b\u0432\u0435\u0434\u0435\u0442<\/p>\n<pre><code class=\"ruby\">0 5 10 15 20 <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"ruby\">0.step(by: 3) do |i|   puts i end  0.step(nil, 3) do |i|   puts i end <\/code><\/pre>\n<p>  \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0432\u044b\u0432\u0435\u0434\u0443\u0442<\/p>\n<pre><code class=\"ruby\">0 3 6 9 12 ... and so on <\/code><\/pre>\n<h5>IO<\/h5>\n<p>  \u041c\u0435\u0442\u043e\u0434 IO#seek \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0440\u044f\u0434\u0443 \u0441 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430\u043c\u0438 IO::SEEK_CUR, IO::SEEK_END \u0438 IO::SEEK_SET \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b Symbol :CUR, :END \u0438 :SET <\/p>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0430\u0440\u0433\u0435\u043c\u043d\u0442\u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c IO::SEEK_DATA \u0438 IO::SEEK_HOLE (\u0438\u043b\u0438 :DATA \u0438 :HOLE). \u041a\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u0437\u0430\u0434\u0430\u043d\u044b, \u043f\u0435\u0440\u0432\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445\/\u043f\u0443\u0441\u0442\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430.<\/p>\n<pre><code class=\"ruby\">f = File.new(&quot;example.txt&quot;)  # sets the offset to the start of the next data chunk at least 8 bytes long f.seek(8, IO::SEEK_DATA)  # sets the offset to the start of the next empty space at least 32 bytes long f.seek(32, IO::SEEK_HOLE) <\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u043d\u0430 \u0432\u0441\u0435\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e IO.const_defined?(:SEEK_DATA) \u0438 IO.const_defined?(:SEEK_HOLE).<\/p>\n<h5>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 IO _nonblock \u0431\u0435\u0437 \u0432\u043e\u0437\u0431\u0443\u0436\u0434\u0435\u043d\u0438\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439<\/h5>\n<p>  \u041c\u0435\u0442\u043e\u0434\u044b IO#read_nonblock \u0438 IO#write_nonblock \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 exception:. \u0415\u0441\u043b\u0438 \u043e\u043d \u0437\u0430\u0434\u0430\u043d \u0432 false (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e true), \u043c\u0435\u0442\u043e\u0434\u044b \u0431\u0443\u0434\u0443\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 Symbol \u0432\u043c\u0435\u0441\u0442\u043e \u0432\u043e\u0437\u0431\u0443\u0436\u0434\u0435\u043d\u0438\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439.<\/p>\n<pre><code class=\"ruby\">require &quot;socket&quot;  io = TCPSocket.new(&quot;www.example.com&quot;, 80)  message = &quot;GET \/ HTTP\/1.1\\r\\nHost: www.example.com\\r\\nConnection: close\\r\\n\\r\\n&quot; loop do   IO.select(nil, [io])   result = io.write_nonblock(message, exception: false)   break unless result == :wait_writeable end  response = &quot;&quot; loop do   IO.select([io])   result = io.read_nonblock(32, exception: false)   break unless result   next if result == :wait_readable   response &lt;&lt; result end  puts response.lines.first <\/code><\/pre>\n<h5>IO \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044e\u044e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0443, \u0435\u0441\u043b\u0438 \u0432\u043d\u0435\u0448\u043d\u044f\u044f ASCII-8BIT<\/h5>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0434\u0430\u0435\u0442\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044e\u044e \u0438 \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, Ruby \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0438\u0437 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438 \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044e\u044e. \u0418\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u0432\u043d\u0435\u0448\u043d\u044f\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430 ASCII-8BIT, \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442.<\/p>\n<p>  \u042d\u0442\u043e \u0436\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u043d\u043e, \u0435\u0441\u043b\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u0443 IO \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430, \u043d\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0431\u044b\u043b\u043e \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c. \u0411\u0430\u0433 \u0431\u044b\u043b \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d.<\/p>\n<pre><code class=\"ruby\">File.read(&quot;example.txt&quot;, encoding: &quot;ascii-8bit:utf-8&quot;).encoding   #=&gt; #&lt;Encoding:ASCII-8BIT&gt; <\/code><\/pre>\n<h5>#include \u0438 #prepend \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044b<\/h5>\n<p>  \u041c\u0435\u0442\u043e\u0434\u044b #include \u0438 #prepend \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044b, \u044d\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 Module \u0438 Class.<\/p>\n<pre><code class=\"ruby\">module NumberQuery   def number?     match(\/\\A(0|-?[1-9][0-9]*)\\z\/) ? true : false   end end  String.include(NumberQuery)  &quot;123&quot;.number?   #=&gt; true <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"ruby\">require &quot;bigdecimal&quot;  module FloatingPointFormat   def to_s(format=&quot;F&quot;)     super   end end  BigDecimal.prepend(FloatingPointFormat)  decimal = BigDecimal(&quot;1.23&quot;) decimal.to_s   #=&gt; &quot;1.23&quot; # rather than &quot;0.123E1&quot; <\/code><\/pre>\n<p>  <i>\u0412 \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0431\u0443\u0434\u0443\u0442 \u043d\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0432 \u043a\u043b\u0430\u0441\u0441\u0430\u0445 Module \u0438 Object, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430\u0445 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435.<\/i><br \/>  <a href=\"http:\/\/habrahabr.ru\/post\/222941\/\">\u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/a>   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/223209\/\"> http:\/\/habrahabr.ru\/post\/223209\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">       <img decoding=\"async\" align=\"right\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/ccd\/b8f\/bab\/ccdb8fbabd2b13bae6145fa4da9c7ac2.png\"\/>  <\/p>\n<h5>Refinements<\/h5>\n<p>  \u0423\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u044f (refinements) \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0438\u0447\u0435\u0439 \u0438 \u043d\u0435 \u0432\u044b\u0432\u043e\u0434\u044f\u0442 \u0432\u043e\u0440\u043d\u0438\u043d\u0433, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432 \u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0442\u0430\u043b\u0435\u0439, \u0434\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u043c.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043a \u043c\u0435\u0442\u043e\u0434\u0443 #using \u0434\u043b\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0439 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0444\u0430\u0439\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0441\u044f \u043c\u0435\u0442\u043e\u0434 Module#using \u0434\u043b\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043c\u043e\u0434\u0443\u043b\u044f. \u041e\u0434\u043d\u0430\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0439 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e \u043b\u0435\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u044c\u044e \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u0442.\u0435. \u043e\u043d\u0438 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0430\u043a\u0442\u0438\u0432\u043d\u044b \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u044f.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-223209","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/223209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=223209"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/223209\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=223209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=223209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=223209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}