Top Level Namespace

Defined Under Namespace

Modules: ActionController, ActionView, DebugSupport, ErrorMailerSupport, PHP, SMKLib, SoftRaise Classes: Array, Date, ErrorMailer, Foo, Hash, Object, SuperLookingList, T

Instance Method Summary collapse

Instance Method Details

#search_array_of_hash(data, value, key = "value", text = "label") ⇒ Object



70
71
72
73
74
75
76
# File 'lib/smklib/array_ext.rb', line 70

def search_array_of_hash(data, value, key="value", text="label")
  return_text = ""
  data.each do |x|
    return_text = x.to_hash[text.to_sym] if x.to_hash[key.to_sym].to_s == value.to_s
  end
  return_text
end