Class: Ciyuan::Character
- Inherits:
-
Object
- Object
- Ciyuan::Character
- Defined in:
- lib/ciyuan/character.rb
Instance Attribute Summary collapse
-
#bronze_images ⇒ Object
Returns the value of attribute bronze_images.
-
#english_explanation ⇒ Object
Returns the value of attribute english_explanation.
-
#etymology ⇒ Object
Returns the value of attribute etymology.
-
#lst_images ⇒ Object
Returns the value of attribute lst_images.
-
#oracle_images ⇒ Object
Returns the value of attribute oracle_images.
-
#phonetic ⇒ Object
Returns the value of attribute phonetic.
-
#seal_images ⇒ Object
Returns the value of attribute seal_images.
-
#simplification ⇒ Object
Returns the value of attribute simplification.
Instance Method Summary collapse
-
#initialize(doc, get_images = false) ⇒ Character
constructor
A new instance of Character.
Constructor Details
#initialize(doc, get_images = false) ⇒ Character
Returns a new instance of Character.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ciyuan/character.rb', line 6 def initialize(doc, get_images=false) @etymology = doc.search("#charEty").first.content @phonetic = doc.search("#charPhon").first.content @simplification = doc.search("#SimplificationMech").first.content @english_explanation = doc.search("#EnglishExplanation").first.content @unicode = doc.search("#SimplifiedUCS2Hex").first.content if get_images @seal_images = doc.search("#SealImages img").map{|element| File.join(BASE_URL,element.attribute("src"))} @lst_images = doc.search("#LstImages img").map{|element| File.join(BASE_URL,element.attribute("src"))} @bronze_images = doc.search("#BronzeImages img").map{|element| File.join(BASE_URL,element.attribute("src"))} @oracle_images = doc.search("#OracleImages img").map{|element| File.join(BASE_URL,element.attribute("src"))} end end |
Instance Attribute Details
#bronze_images ⇒ Object
Returns the value of attribute bronze_images.
3 4 5 |
# File 'lib/ciyuan/character.rb', line 3 def bronze_images @bronze_images end |
#english_explanation ⇒ Object
Returns the value of attribute english_explanation.
3 4 5 |
# File 'lib/ciyuan/character.rb', line 3 def english_explanation @english_explanation end |
#etymology ⇒ Object
Returns the value of attribute etymology.
3 4 5 |
# File 'lib/ciyuan/character.rb', line 3 def etymology @etymology end |
#lst_images ⇒ Object
Returns the value of attribute lst_images.
3 4 5 |
# File 'lib/ciyuan/character.rb', line 3 def lst_images @lst_images end |
#oracle_images ⇒ Object
Returns the value of attribute oracle_images.
3 4 5 |
# File 'lib/ciyuan/character.rb', line 3 def oracle_images @oracle_images end |
#phonetic ⇒ Object
Returns the value of attribute phonetic.
3 4 5 |
# File 'lib/ciyuan/character.rb', line 3 def phonetic @phonetic end |
#seal_images ⇒ Object
Returns the value of attribute seal_images.
3 4 5 |
# File 'lib/ciyuan/character.rb', line 3 def seal_images @seal_images end |
#simplification ⇒ Object
Returns the value of attribute simplification.
3 4 5 |
# File 'lib/ciyuan/character.rb', line 3 def simplification @simplification end |