Class: PictureFrom::Keyword

Inherits:
Object
  • Object
show all
Defined in:
lib/picture_from/keyword.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Keyword

Returns a new instance of Keyword.



6
7
8
# File 'lib/picture_from/keyword.rb', line 6

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



4
5
6
# File 'lib/picture_from/keyword.rb', line 4

def value
  @value
end

Instance Method Details

#typeObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/picture_from/keyword.rb', line 10

def type
  case value
  when /^@?([\w\.])*$/
    :username
  when /.+@.+/
    :email
  else
    :user_info
  end
end