Method: Castic#props

Defined in:
lib/castic.rb

#props(key = nil) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/castic.rb', line 42

def props(key = nil)
  body = if @type == :Formula
    @tree[1][class_index+1]
  else
    @tree[class_index+1]
  end

  if key
    body.select { |n|
      n[1] == key.to_sym
    }
  else
    body
  end.map { |n|
    n.last n.length - 1
  }
end