Aravind 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/aravind.rb +33 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6695be6317588abe135d77754f56d2933efc4d7b
|
4
|
+
data.tar.gz: c4e657b6e41954b9427f0956f9cbf8f799596d7f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7c38ba996a7e35fdf83bc830cf98b26c40cb4b5425f1bd9e2365416bd5c0ff9345b599d4c0b6a57523c9d5ff1998cb0ee760775e45cc6fd2816d6f39c47e9948
|
7
|
+
data.tar.gz: 945fe003639ee3f76cd8f538538fbb18d5dbc0b7881dc44707f4fbd1a2debe6f6d311b053946b6c8f48e56fa8e1df6c21bd9064aa41b16ce2edebae07694e862
|
data/lib/aravind.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
puts "press enter to start"
|
2
|
+
gets
|
3
|
+
arr = Array[]
|
4
|
+
puts "enter the size of array you want"
|
5
|
+
size = gets.chomp.to_i
|
6
|
+
if size == 0
|
7
|
+
puts "please enter correct size"
|
8
|
+
else
|
9
|
+
for i in 0..size-1
|
10
|
+
puts "enter element #{i+1}"
|
11
|
+
element = gets.chomp
|
12
|
+
arr << "#{element}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
print "\nthe resulting array is #{arr}\n\n"
|
16
|
+
arr_main = Array.new(arr)
|
17
|
+
dup = arr.select{|duplicate| arr.count(duplicate)>1}.uniq
|
18
|
+
puts "the duplicates which you have entered is/are : #{dup}\n"
|
19
|
+
puts "the duplicates count is: #{dup.count}\n"
|
20
|
+
unique = arr.uniq
|
21
|
+
puts "total unique elements count is #{unique.count}\n\n"
|
22
|
+
puts "the main array is #{arr}\n\n"
|
23
|
+
puts "enter an element that you want to remove"
|
24
|
+
rem = gets.chomp.to_s
|
25
|
+
removed = arr.delete(rem)
|
26
|
+
puts "the resulting array after removing '#{rem}' is :#{arr}\n\n"
|
27
|
+
puts "enter the element which you want to replace from #{arr_main}:"
|
28
|
+
replace = gets.chomp
|
29
|
+
puts "enter the element with which you want to replace with:"
|
30
|
+
replaced = gets.chomp
|
31
|
+
arr_main.collect! {|element| (element == replace) ? replaced : element}
|
32
|
+
print "the final array is #{arr_main} \n\n"
|
33
|
+
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: Aravind
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Aravind sravan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-08 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple Aravind's first gem
|
14
|
+
email: Aravind.aravind@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/aravind.rb
|
20
|
+
homepage: http://rubygems.org/gems/hola
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.4.6
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Aravind!
|
44
|
+
test_files: []
|