More elegant solution:
# Counter-clockwise angle from vector2 to vector1, as seen from normal.
def angle_in_plane(vector1, vector2, normal = Z_AXIS)
Math.atan2((vector2 * vector1) % normal, vector1 % vector2)
end
def edge_angle(edge)
angle = angle_in_plane(edge.faces[0].normal, edge.faces[1].normal, edge.line[1])
# Assuming mesh is oriented, i.e. edge is reversed in exactly one out of the two
# faces. If not, the return value depends the order the faces are presented in.
edge.reversed_in?(edge.faces[0]) ? angle : -angle
end
# Float#radians method converts from radians to degrees.
# Use radians internally as it is what the math functions uses,
# but convert at display layer.
edge_angle(Sketchup.active_model.selection.first).radians