Sha256: 0ce864f079b5af927352e6c8a0df2237f4203e8727f563b654d0a25c6d2d4224
Contents?: true
Size: 1.91 KB
Versions: 10
Compression:
Stored size: 1.91 KB
Contents
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>started_at_time= (Work)</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> </head> <body class="standalone-code"> <pre><span class="ruby-comment cmt"># File app/models/work.rb, line 76</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">started_at_time=</span>(<span class="ruby-identifier">new_value</span>) <span class="ruby-identifier">raise</span> <span class="ruby-node">"invalid time format: #{new_value}"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">new_value</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/(\d{2}):(\d{2})/</span> <span class="ruby-identifier">new_hour</span>, <span class="ruby-identifier">new_minutes</span> = <span class="ruby-identifier">$1</span>, <span class="ruby-identifier">$2</span> <span class="ruby-identifier">t</span> = <span class="ruby-identifier">started_at</span> <span class="ruby-operator">||</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">started_at</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-identifier">t</span>.<span class="ruby-identifier">year</span>, <span class="ruby-identifier">t</span>.<span class="ruby-identifier">month</span>, <span class="ruby-identifier">t</span>.<span class="ruby-identifier">day</span>, <span class="ruby-identifier">new_hour</span>, <span class="ruby-identifier">new_minutes</span>) <span class="ruby-keyword kw">end</span></pre> </body> </html>
Version data entries
10 entries across 5 versions & 1 rubygems