Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
85ff2d8
Create Ruby programming language
ACR1209 Jan 2, 2025
f1291ff
Added ruby array manipulation category and some snippets
ACR1209 Jan 2, 2025
92c408c
Add Ruby string manipulation snippets
ACR1209 Jan 2, 2025
993a50a
Add Ruby snippet for calculating compound interest
ACR1209 Jan 2, 2025
43f49a1
Add Ruby Sieve of Sundaram snippet
ACR1209 Jan 2, 2025
3807b5c
Add Ruby snippet for checking prime numbers
ACR1209 Jan 2, 2025
ec3ee2b
Add Ruby snippet for calculating factorial
ACR1209 Jan 2, 2025
cdbd348
Add Ruby snippet for defining and raising a custom error class
ACR1209 Jan 2, 2025
88fcb81
Add Ruby snippet for implementing a basic binary tree with in-order t…
ACR1209 Jan 2, 2025
d6364c6
Add Ruby snippet for implementing a singly linked list with node inse…
ACR1209 Jan 2, 2025
9f15bd9
Add Ruby snippet for implementing a doubly linked list with node inse…
ACR1209 Jan 2, 2025
108ca7b
Update consolidated snippets
actions-user Jan 2, 2025
5caa33c
Fix to fit new guidelines for snippets
ACR1209 Jan 2, 2025
461ae2d
Update consolidated snippets
actions-user Jan 2, 2025
28703fa
Apply feedback to align with contributing guidelines and add new snip…
ACR1209 Jan 3, 2025
0c2e2b3
Update consolidated snippets
actions-user Jan 3, 2025
e40c812
Rename function to transform from snake_case to PascalCase in Ruby sn…
ACR1209 Jan 4, 2025
bebe1c7
Update consolidated snippets
actions-user Jan 4, 2025
0c87a21
Merge branch 'main' into ruby-language
ACR1209 Jan 4, 2025
0ac16f0
Update consolidated snippets
actions-user Jan 4, 2025
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename function to transform from snake_case to PascalCase in Ruby sn…
…ippet
  • Loading branch information
ACR1209 committed Jan 4, 2025
commit e40c8123d6480f5c196e3b3121b8b30d27c91548
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ tags: string,convert,snake-case,pascal-case
---

```rb
def snake_to_camel(str)
def snake_to_pascal(str)
str.split('_').map.with_index { |word, index|
word.capitalize
}.join
end

# Usage:
snake_case = "snake_case_to_pascal_case"
puts snake_to_camel(snake_case) # Output: "SnakeCaseToPascalCase"
puts snake_to_pascal(snake_case) # Output: "SnakeCaseToPascalCase"
```