<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>ytnk531</author_name>
  <author_url>https://blog.hatena.ne.jp/ytnk531/</author_url>
  <blog_title>マイペースなRailsおじさん</blog_title>
  <blog_url>https://ytnk531.hatenablog.com/</blog_url>
  <categories>
  </categories>
  <description>下記のようなソースコードdata.rbがあったとする build([1, 3, 7, 0, 1, 3]) このソースコードでbuildに渡している引数の合計を、外部から取得して合計を求める。 code = File.read('data.rb') root = RubyVM::AbstractSyntaxTree.parse(code, keep_script_lines: true) args = nil eval &quot;args = #{root.children[2].children[1].source}&quot; args.sum # =&gt; 15 keep_script_lines: trueを…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fytnk531.hatenablog.com%2Fentry%2F2022%2F05%2F28%2F045512&quot; title=&quot;RubyVM::AbstractSyntaxTreeを使ってソースコード内のデータを引っ張り出す - マイペースなRailsおじさん&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2022-05-28 04:55:12</published>
  <title>RubyVM::AbstractSyntaxTreeを使ってソースコード内のデータを引っ張り出す</title>
  <type>rich</type>
  <url>https://ytnk531.hatenablog.com/entry/2022/05/28/045512</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
