lib/scooby_snacks/field.rb in scooby_snacks-0.3.7 vs lib/scooby_snacks/field.rb in scooby_snacks-0.3.8

- old
+ new

@@ -42,9 +42,20 @@ define_method("#{attribute_name}".to_sym) do @raw_array[attribute_name.to_s] end end + def example + return @raw_array["example"] if @raw_array["example"] + if controlled? + return "http://id.loc.gov/authorities/names/n2002034393" + elsif date? + return "01-01-1901" + else + return "Example #{name.titleize}" + end + end + def controlled? return @controlled unless @controlled.nil? @controlled = false @controlled = true if @raw_array['controlled'].to_s == "true" @controlled = true if @raw_array['input'].to_s.include? "controlled"