ruby tag

542 questions


2 answers
37 views
0
To Determine if Ruby Has a Time Object Within 24 Hours

How can ruby determine if the DateTime object is within 24 hours?I'd like to do time=time.zone.now and then go see time to determine if it's within 24 hours.

2 years ago

2 answers
41 views
0
Ruby Abbreviation Contents

Trying abbreviationsarray1=%w[Yes]array2 = [A, I, U]puts array==array2false returned after running .If I use abbreviation, will the contents change?

2 years ago

2 answers
96 views
0
rspec does not pass the test using create_list in factorybot

spec/factories/projects.rbI would like to set the user.rb to create 5 projects each time a user is created, but an error is printed and it does not work well.FactoryBot.definedo factory —Project do se...

2 years ago

1 answers
114 views
0
To partially extract a text page with nokogiri

Linux Kernel (https://cdn.kernel.org/pub/linux/kernel/v4.x/ChangeLog-4.1.30)Becky!(http://www.rimarts.jp/downloads/B2/Readme.txt)For pages that consist only of text, such as Changelog and Readme above...

2 years ago

3 answers
35 views
0
How to create classes that can be instantiated without using new in Ruby

How do I create classes that I can use without using new like Post.all like ActiveRecord?For example, by defining something for a class called Person,Person('yoshida').ageI'm thinking of using it in a...

2 years ago

1 answers
40 views
0
I want to know how Ruby can rearrange the array.

I don't know the code in split that would be a two-dimensional array of result.Do not use the library.[ { :type=>h1,:value=>1, :children=>[{:type=>p,:value=>2}] }, { :type=>h2,:value...

2 years ago

2 answers
38 views
0
I can't pass the rails well.

railsg controller api/hello --no-assets --no-helper I ran this command to create an api for testing, but I can't pass it wellhello_controller.rb class Api::HelloController<ApplicationController def...

2 years ago

1 answers
36 views
0
How to output information grouped by each value in rails?

I'm a beginner at rails.I'm studying at rails5.Prefectures, stations, and route names are all different models, and we have associations. ########Model##################################### pref.rb (pr...

2 years ago

1 answers
35 views
0
Ruby requires different files, but there are two other classes that are almost the same.

I'm a beginner at ruby.There are two classes that are almost the same except for the requirements below.Is there a better way to write this?Thank you for your cooperation.class Foo require'aaa'#Foo a...

2 years ago

1 answers
66 views
0
Please tell me about Ruby's framework.

Excuse me.What are some of Ruby's web application frameworks that are actually used outside of Rails?Thank you for your cooperation.

« - 20 - »

© 2024 OneMinuteCode. All rights reserved.