Answers for "ruby"

24

ruby

Ruby is python but with slightly different syntax
Posted by: Guest on June-11-2020
1

ruby &:

ar.map(&:reverse)
Posted by: Guest on August-25-2020
0

ruby for programmers

irb(main):001:0> "Hello World"
=> "Hello World"
Posted by: Guest on January-13-2021
0

ruby

this is my application_controller.rb file

private

  def default_url_options
    { locale: I18n.locale }
  end


  def set_locale
    I18n.locale = extract_locale || I18n.default_locale
  end

  def extract_locale
    parsed_locale = params[:locale]
    I18n.available_locales.map(&:to_s).include?(parsed_locale) ? parsed_locale.to_sym : nil
  end```

This is my route.rb file

  scope "(:locale)", locale: /#{I18n.available_locales.join("|")}/ do
    get 'careers' => 'pages#careers', :as => :careers
end
Posted by: Guest on June-12-2021
0

ruby |=

# When working with arrays |= is useful for uniquely appending to an array.
>> x = [1,2,3]
>> y = [3,4,5]

>> x |= y
>> x
=> [1, 2, 3, 4, 5]
Posted by: Guest on December-15-2020
0

ruby for programmers

irb(main):003:0> 3+2
=> 5
Posted by: Guest on January-13-2021

Browse Popular Code Answers by Language