Class: Crystel
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #blank_input ⇒ Object
- #contains?(smaller_thing) ⇒ Boolean
- #from_prompt(user_input) ⇒ Object
- #in(bigger_thing) ⇒ Object
-
#initialize(value = "") ⇒ Crystel
constructor
A new instance of Crystel.
- #isin?(bigger_thing) ⇒ Boolean
- #print ⇒ Object
- #s(num1, num2 = " ") ⇒ Object
- #s!(num1, num2 = " ") ⇒ Object
Constructor Details
#initialize(value = "") ⇒ Crystel
Returns a new instance of Crystel.
3 4 5 |
# File 'lib/crystel.rb', line 3 def initialize(value="") @value = value end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
6 7 8 |
# File 'lib/crystel.rb', line 6 def value @value end |
Instance Method Details
#blank_input ⇒ Object
10 11 12 |
# File 'lib/crystel.rb', line 10 def blank_input @value = gets.chomp end |
#contains?(smaller_thing) ⇒ Boolean
23 24 25 |
# File 'lib/crystel.rb', line 23 def contains?(smaller_thing) @value.include? smaller_thing end |
#from_prompt(user_input) ⇒ Object
13 14 15 16 |
# File 'lib/crystel.rb', line 13 def from_prompt(user_input) puts user_input @value = gets.chomp end |
#in(bigger_thing) ⇒ Object
20 21 22 |
# File 'lib/crystel.rb', line 20 def in(bigger_thing) bigger_thing.include? @value end |
#isin?(bigger_thing) ⇒ Boolean
17 18 19 |
# File 'lib/crystel.rb', line 17 def isin?(bigger_thing) bigger_thing.value.include? @value end |
#print ⇒ Object
7 8 9 |
# File 'lib/crystel.rb', line 7 def print @value end |
#s(num1, num2 = " ") ⇒ Object
26 27 28 29 30 31 |
# File 'lib/crystel.rb', line 26 def s(num1, num2=" ") if num2 == " " num2 = @value.length end @value[num1...num2] end |
#s!(num1, num2 = " ") ⇒ Object
32 33 34 35 36 37 |
# File 'lib/crystel.rb', line 32 def s!(num1, num2=" ") if num2 == " " num2 = @value.length end self.replace(@value[num1...num2]) end |