{"id":295831,"date":"2019-12-17T16:28:48","date_gmt":"2019-12-17T16:28:48","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=295831"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=295831","title":{"rendered":"\u0415\u0449\u0435 \u043e\u0434\u0438\u043d DSL \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0439"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/479600\/\">\n<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0433\u0435\u043c \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0439 \u0438 \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0432\u0430\u043c\u0438 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439.<\/p>\n<p>  <\/p>\n<p>\u0418\u0434\u0435\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430<\/li>\n<li>\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043c\u0430\u0433\u0438\u0438<\/li>\n<li>\u041b\u0435\u0433\u043a\u043e\u0441\u0442\u044c \u0432 \u043e\u0441\u0432\u043e\u0435\u043d\u0438\u0438<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u044d\u0442\u0438 \u043f\u0443\u043d\u043a\u0442\u044b \u0437\u0430\u0432\u044f\u0437\u0430\u043d\u044b \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u2014 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0435. \u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0435 \u043e\u0442\u043d\u0438\u043c\u0443 \u0443 \u0432\u0430\u0441 \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>  <\/p>\n<p>\u0421 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f <a href=\"https:\/\/github.com\/Nondv\/st_validation.rb\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h1 id=\"arhitektura\">\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430<\/h1>\n<p>  <\/p>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0433\u043e DSL \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u0431\u043b\u043e\u043a\u043e\u0432 \u044f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435.<br \/>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0433\u043e \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e-\u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e (\u0445\u0430\u0445\u0430, \u043d\u0443 \u0432\u044b \u043f\u043e\u043d\u044f\u043b\u0438, \u0434\u0430? &#171;\u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e-\u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439&#187;) DSL \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 Dry, \u043c\u043e\u0439 DSL \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440. \u0422\u0430\u043a \u0436\u0435 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 (\u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438) \u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0438\u0442\u043e\u043d\u0435), \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0430\u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<p>\u0427\u0438\u0442\u0430\u044e \u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u0433\u0440\u0430\u0444 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u0447\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043a\u0430\u0448\u0443. \u041f\u0440\u043e\u0448\u0443 \u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0434\u0430\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u0438 \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<p>  <\/p>\n<h3 id=\"opredeleniya\">\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u0412\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043d\u0430 \u0442\u0440\u0435\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043a\u043e\u043d\u0446\u0435\u043f\u0442\u0430\u0445: <em>\u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440<\/em>, <em>\u0441\u0445\u0435\u043c\u0430<\/em> (blueprint) \u0438 <em>\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/em> (transformation).<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0412\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u2014 \u0442\u043e, \u0440\u0430\u0434\u0438 \u0447\u0435\u0433\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0438 \u043d\u0443\u0436\u043d\u0430. \u041e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u043b\u0438 \u043d\u0435\u0447\u0442\u043e \u043d\u0430\u0448\u0438\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c.<\/li>\n<li>\u0421\u0445\u0435\u043c\u0430 \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 (\u0446\u0435\u043b\u044c \u043d\u0430\u0448\u0435\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438).<\/li>\n<li>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>t(b, f)<\/code>, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0443 \u0438 \u043e\u0431\u044a\u0435\u043a\u0442, \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e (\u0444\u0430\u0431\u0440\u0438\u043a\u0430), \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u043d\u0430 \u043b\u0438\u0431\u043e \u0434\u0440\u0443\u0433\u0443\u044e \u0441\u0445\u0435\u043c\u0443, \u043b\u0438\u0431\u043e \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440.<br \/>  \u041a\u0441\u0442\u0430\u0442\u0438, \u0441\u043b\u043e\u0432\u043e &#171;\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435&#187; \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u0432 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0438\u043d\u043e\u043d\u0438\u043c\u043e\u043c \u0441\u043b\u043e\u0432\u0430 &#171;\u0444\u0443\u043d\u043a\u0446\u0438\u044f&#187; (\u0432\u043e \u0432\u0441\u044f\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0432 \u043a\u043d\u0438\u0436\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0447\u0438\u0442\u0430\u043b \u0432 \u0443\u043d\u0438\u0432\u0435\u0440\u0435).<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0424\u0430\u0431\u0440\u0438\u043a\u0430, \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0414\u043b\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439 <code>T1, T2, ..., Tn<\/code> \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f <code>Ta(Tb(Tc(...)))<\/code> (\u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439).<\/li>\n<li>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a \u0441\u0445\u0435\u043c\u0435 \u0446\u0438\u043a\u043b\u0438\u0447\u043d\u043e, \u043f\u043e\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041c\u043d\u0435 \u044d\u0442\u043e \u0447\u0435\u043c-\u0442\u043e \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u043c\u0430\u0448\u0438\u043d\u0443 \u0422\u044c\u044e\u0440\u0438\u043d\u0433\u0430. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 (\u0438\u043b\u0438 \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e). \u0427\u0442\u043e-\u043b\u0438\u0431\u043e \u0438\u043d\u043e\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u0445\u0435\u043c\u0430 \u0438(\u043b\u0438) \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043d\u0435\u0432\u0435\u0440\u043d\u044b.<\/p>\n<p>  <\/p>\n<h3 id=\"primer\">\u041f\u0440\u0438\u043c\u0435\u0440<\/h3>\n<p>  <\/p>\n<p>\u041d\u0430 \u0440\u0435\u0434\u0434\u0438\u0442\u0435 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u043f\u0440\u0438\u0432\u0435\u043b \u043f\u0440\u0438\u043c\u0435\u0440 \u0432 Dry:<\/p>\n<p>  <\/p>\n<pre><code class=\"ruby\">user_schema = Dry::Schema.Params do   required(:id).value(:integer)   required(:name).value(:string)   required(:age).value(:integer, included_in?: 0..150)   required(:favourite_food).value(array[:string])   required(:dog).maybe do     hash do       required(:name).value(:string)       required(:age).value(:integer)       optional(:breed).maybe(:string)     end   end end  user_schema.call(id: 123, name: \"John\", age: 18, ...).success?<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0430\u0433\u0438\u044f \u0432 \u0432\u0438\u0434\u0435 <code>required(..).value<\/code> \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0432\u0440\u043e\u0434\u0435 <code>#array<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0421\u0440\u0430\u0432\u043d\u0438\u0442\u0435 \u0441 \u043c\u043e\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"ruby\">is_valid_user = StValidation.build(   id: Integer,   name: String,   age: -&gt;(x) { x.is_a?(Integer) &amp;&amp; (0..150).cover?(x) },   favourite_food: [String],   dog: Set[NilClass, { name: String, age: Integer, breed: Set[NilClass, String] }] )  is_valid_user.call(id: 123, name: 'John', age: 18, ...)<\/code><\/pre>\n<p>  <\/p>\n<ol>\n<li>\u0414\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0445\u0435\u0448\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f\u2026 \u0445\u0435\u0448. \u0414\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u043a\u043b\u0430\u0441\u0441\u044b, \u043c\u0430\u0441\u0441\u0438\u0432\u044b, \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430, \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438). \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 (<code>#build<\/code> \u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f, \u0442.\u043a. \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c).<\/li>\n<li>\u0418\u0442\u043e\u0433\u043e\u0432\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e true\/false, \u043e \u0447\u0435\u043c \u043c\u044b \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0438 \u0432\u043e\u043b\u043d\u0443\u0435\u043c\u0441\u044f. \u042d\u0442\u043e \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c, \u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u0435\u043c.<\/li>\n<li>\u0412 Dry \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0445\u0435\u0448 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043e\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e. \u041d\u0430 \u0432\u043d\u0435\u0448\u043d\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <code>Schema.Params<\/code>, \u0430 \u0432\u043d\u0443\u0442\u0440\u0438 <code>#hash<\/code>.<\/li>\n<li>(\u0431\u043e\u043d\u0443\u0441) \u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u043d \u0431\u044b\u0442\u044c \u0445\u0435\u0448\u0435\u043c \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430: <code>is_int = StValidation.build(Integer)<\/code>.<br \/>  \u041a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u0445\u0435\u043c\u044b \u0441\u0430\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0445\u0435\u043c\u043e\u0439. \u0425\u0435\u0448 \u2014 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u044b (\u0442.\u0435. \u0441\u0445\u0435\u043c\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0445\u0435\u043c).<\/li>\n<\/ol>\n<p>  <\/p>\n<h1 id=\"struktura\">\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430<\/h1>\n<p>  <\/p>\n<p>\u0412\u0435\u0441\u044c \u0433\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0447\u0430\u0441\u0442\u0435\u0439:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u043c\u0435\u043d (\u043c\u043e\u0434\u0443\u043b\u044c) <code>StValidation<\/code><\/li>\n<li>\u0424\u0430\u0431\u0440\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u043e\u0432, <code>StValidation::ValidatorFactory<\/code>.<\/li>\n<li>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 <code>StValidation::AbstractValidator<\/code>, \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0439\u0441\u044f, \u043f\u043e \u0441\u0443\u0442\u0438, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c.<\/li>\n<li>\u041d\u0430\u0431\u043e\u0440 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0432\u043a\u043b\u044e\u0447\u0438\u043b \u0432 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 &#171;\u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441&#187; \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 <code>StValidation::Validators<\/code><\/li>\n<li>\u0414\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432:<br \/> \n<ul>\n<li><code>StValidation.build<\/code> \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0439<\/li>\n<li><code>StValidation.with_extra_transformations<\/code> \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0439, \u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0449\u0438\u0439 \u0435\u0433\u043e.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<h1 id=\"standartnyy-dsl\">\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 DSL<\/h1>\n<p>  <\/p>\n<p>\u0412 \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 DSL \u044f \u0432\u043a\u043b\u044e\u0447\u0438\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041a\u043b\u0430\u0441\u0441 \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0442\u0438\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, Integer).<br \/>  \u041f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u0432 \u043c\u043e\u0435\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435, \u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u044f \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u043e\u0432 AbstractValidator, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430\u043c\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430.<\/li>\n<li>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u2014 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441\u0445\u0435\u043c. \u041f\u0440\u0438\u043c\u0435\u0440: <code>Set[Integer, -&gt;(x) { x.nil? }]<\/code>.<br \/>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 <em>\u0441\u0445\u0435\u043c<\/em>. \u0414\u0430\u0436\u0435 \u0441\u0430\u043c \u043a\u043b\u0430\u0441\u0441 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>UnionValidator<\/code>.<br \/>  \u041f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0442\u043d\u043e\u0433\u043e \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u0430.<\/li>\n<li>\u041c\u0430\u0441\u0441\u0438\u0432 \u2014 \u043f\u0440\u0438\u043c\u0435\u0440: <code>[Integer]<\/code>.<br \/>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u0438 \u0432\u0441\u0435 \u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 <em>\u0441\u0445\u0435\u043c\u0435<\/em>.<\/li>\n<li>\u0425\u0435\u0448 \u2014 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043d\u043e \u0434\u043b\u044f \u0445\u0435\u0448\u0435\u0439. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u044e\u0447\u0438 \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442\u0441\u044f.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041d\u0430\u0431\u043e\u0440 \u0442\u0440\u0430\u043d\u0441\u043e\u0440\u043c\u0430\u0446\u0438\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"ruby\">def basic_transformations   [     -&gt;(bp, _factory) { bp.is_a?(Class) ? class_validator(bp) : bp },     -&gt;(bp, factory) { bp.is_a?(Set) ? union_validator(bp, factory) : bp },     -&gt;(bp, factory) { bp.is_a?(Hash) ? hash_validator(bp, factory) : bp },     -&gt;(bp, factory) { bp.is_a?(Array) &amp;&amp; bp.size == 1 ? array_validator(bp[0], factory) : bp }   ] end  def class_validator(klass)   Validators::ClassValidator.new(klass) end  def union_validator(blueprint, factory)   Validators::UnionValidator.new(blueprint, factory) end  # ...<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0449\u0435 \u043d\u0435\u043a\u0443\u0434\u0430, \u043d\u0435 \u043f\u0440\u0430\u0432\u0434\u0430 \u043b\u0438?<\/p>\n<p>  <\/p>\n<h1 id=\"oshibki-i-explain\">\u041e\u0448\u0438\u0431\u043a\u0438 \u0438 #explain<\/h1>\n<p>  <\/p>\n<p>\u041b\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0435\u043b\u044c\u044e \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u0432\u0430\u043b\u0438\u0434\u0435\u043d \u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442. \u041f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d \u043d\u0435 \u0432\u0430\u043b\u0438\u0434\u0435\u043d \u2014 \u0443\u0436\u0435 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441.<br \/>  \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0447\u0442\u043e-\u0442\u043e \u043d\u0435 \u0432\u0430\u043b\u0438\u0434\u043d\u043e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u0430 \u043c\u0435\u0442\u043e\u0434 <code>#explain<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438, \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f, \u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u043d\u0435 \u0442\u0430\u043a.<br \/>  \u0412 \u0446\u0435\u043b\u043e\u043c, \u0441\u0430\u043c\u0443 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e (<code>#call<\/code>) \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 <code>#explain<\/code>, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0432, \u043f\u0443\u0441\u0442\u043e\u0439 \u043b\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 explain.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0430\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f, \u043e\u0434\u043d\u0430\u043a\u043e, \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 (\u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0432\u0430\u0436\u043d\u043e).<\/p>\n<p>  <\/p>\n<p>\u0422.\u043a. \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438-\u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u044b \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430 <code>AbstractValidator<\/code>, \u043e\u043d\u0438 \u0442\u043e\u0436\u0435 \u0438\u043c\u0435\u044e\u0442 \u043c\u0435\u0442\u043e\u0434 <code>#explain<\/code> \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442, \u0433\u0434\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u043e\u0432, <code>#explain<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043a\u043e\u043b\u044c \u0443\u0433\u043e\u0434\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u043c \u0438 \u0443\u043c\u043d\u044b\u043c.<\/p>\n<p>  <\/p>\n<h1 id=\"kastomizaciya\">\u041a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u044f<\/h1>\n<p>  <\/p>\n<p>\u041c\u043e\u0439 &#171;\u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441&#187; \u043d\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d \u0432 \u0441\u0435\u0440\u0434\u0446\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u0435\u043d \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e. (\u0441\u043c. <code>StValidation.build<\/code>).<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 DSL, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u043b\u0430, \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"ruby\">validator_factory = StValidation::ValidatorFactory.new(   [     -&gt; (blueprint, _) { blueprint == :int ? -&gt;(x) { x.is_a?(Integer) } : blueprint },     -&gt; (blueprint, _) { blueprint == :str ? -&gt;(x) { x.is_a?(String) } : blueprint },     lambda do |blueprint, factory|       return blueprint unless blueprint.is_a?(Array)        inner_validators = blueprint.map { |b| factory.build(b) }       -&gt;(x) { x.is_a?(Array) &amp;&amp; inner_validators.zip(x).all? { |v, e| v.call(e) } }     end   ] )  is_int = validator_factory.build(:int) is_int.call('123') # ==&gt; false  is_int_pair = validator_factory.build([:int, :int]) is_int_pair.call([1, 2]) # ==&gt; true is_int_pair.call([1, '2']) # ==&gt; false<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0441\u0442\u0438\u0442\u0435 \u0437\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434. \u041f\u043e \u0441\u0443\u0442\u0438, \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443.<\/p>\n<p>  <\/p>\n<h1 id=\"itog\">\u0418\u0442\u043e\u0433<\/h1>\n<p>  <\/p>\n<p>\u0410 \u043d\u0435\u0442 \u0435\u0433\u043e. \u041f\u0440\u043e\u0441\u0442\u043e \u044f \u0433\u043e\u0440\u0436\u0443\u0441\u044c \u0434\u0430\u043d\u043d\u044b\u043c \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0438 \u0445\u043e\u0442\u0435\u043b \u0435\u0433\u043e \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \ud83d\ude42<\/p>\n<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d() } } }t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>      <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/479600\/\"> https:\/\/habr.com\/ru\/post\/479600\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/479600\/\">\n<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0433\u0435\u043c \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0439 \u0438 \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0432\u0430\u043c\u0438 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439.<\/p>\n<p>  <\/p>\n<p>\u0418\u0434\u0435\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430<\/li>\n<li>\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043c\u0430\u0433\u0438\u0438<\/li>\n<li>\u041b\u0435\u0433\u043a\u043e\u0441\u0442\u044c \u0432 \u043e\u0441\u0432\u043e\u0435\u043d\u0438\u0438<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u044d\u0442\u0438 \u043f\u0443\u043d\u043a\u0442\u044b \u0437\u0430\u0432\u044f\u0437\u0430\u043d\u044b \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u2014 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0435. \u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0435 \u043e\u0442\u043d\u0438\u043c\u0443 \u0443 \u0432\u0430\u0441 \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>  <\/p>\n<p>\u0421 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f <a href=\"https:\/\/github.com\/Nondv\/st_validation.rb\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/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-295831","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/295831","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=295831"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/295831\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=295831"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=295831"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=295831"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}