Module: JEDICT::NodeExtention
- Defined in:
- lib/jedict.rb
Constant Summary collapse
- PATHS =
{ meaning: [:sense, :gloss, :value], kanji_representation: [:k_ele, :keb, :value], reading_representation: [:r_ele, :reb, :value], kanji_priority: [:k_ele, :ke_pri, :value], reading_priority: [:r_ele, :re_pri, :value], kanji_information: [:k_ele, :ke_inf, :value], reading_information: [:r_ele, :re_inf, :value], sense_information: [:sense, :s_inf, :value], gramatical_position: [:sense, :pos, :value], lexical_field: [:sense, :field, :value], dialect: [:sense, :dial, :value], # primary_meaning: [:sense, :gloss, :pri, :value], # In the documentation but doesn't actually appear in the dictionnary at the time of writing (2017/12/17) }
Class Method Summary collapse
Instance Method Summary collapse
-
#to_s ⇒ Object
primary_meaning: [:sense, :gloss, :pri, :value], # In the documentation but doesn’t actually appear in the dictionnary at the time of writing (2017/12/17).
Class Method Details
.elements_at(node, path, *args) ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/jedict.rb', line 97 def self.elements_at node, path, *args if args.length == 0 if node.is_a? Hash [node[path]].flatten.compact elsif node.is_a? Array node.map { |e| e[path] }.flatten.compact else [node] end else if node.is_a? Array node.map { |e| elements_at e[path], *args }.flatten.compact elsif node.is_a? Hash elements_at(node[path], *args).flatten.compact else [] end end end |
Instance Method Details
#to_s ⇒ Object
primary_meaning: [:sense, :gloss, :pri, :value], # In the documentation but doesn’t actually appear in the dictionnary at the time of writing (2017/12/17)
93 94 95 |
# File 'lib/jedict.rb', line 93 def to_s JEDICT::format_node(self).strip end |