Class: Sovren::Language
- Inherits:
-
Object
- Object
- Sovren::Language
- Defined in:
- lib/sovren/language.rb
Instance Attribute Summary collapse
-
#language_code ⇒ Object
Returns the value of attribute language_code.
-
#read ⇒ Object
Returns the value of attribute read.
-
#speak ⇒ Object
Returns the value of attribute speak.
-
#write ⇒ Object
Returns the value of attribute write.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#language_code ⇒ Object
Returns the value of attribute language_code.
3 4 5 |
# File 'lib/sovren/language.rb', line 3 def language_code @language_code end |
#read ⇒ Object
Returns the value of attribute read.
3 4 5 |
# File 'lib/sovren/language.rb', line 3 def read @read end |
#speak ⇒ Object
Returns the value of attribute speak.
3 4 5 |
# File 'lib/sovren/language.rb', line 3 def speak @speak end |
#write ⇒ Object
Returns the value of attribute write.
3 4 5 |
# File 'lib/sovren/language.rb', line 3 def write @write end |
Class Method Details
.parse(languages) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/sovren/language.rb', line 5 def self.parse(languages) return Array.new if languages.nil? result = languages.css('Language').collect do |item| c = Language.new c.language_code = item.css('LanguageCode').text c.read = item.css('Read').text == "true" rescue nil c.write = item.css('Write').text == "true" rescue nil c.speak = item.css('Speak').text == "true" rescue nil c end result end |
Instance Method Details
#read? ⇒ Boolean
18 19 20 |
# File 'lib/sovren/language.rb', line 18 def read? !read.nil? && read end |
#speak? ⇒ Boolean
26 27 28 |
# File 'lib/sovren/language.rb', line 26 def speak? !speak.nil? && speak end |
#write? ⇒ Boolean
22 23 24 |
# File 'lib/sovren/language.rb', line 22 def write? !write.nil? && write end |