Module: Florrick::ActiveRecordExtension::ClassMethods
- Defined in:
- lib/florrick/active_record_extension.rb
Instance Method Summary collapse
-
#florrick(&block) ⇒ Object
Accept a new set of configuration for this model.
-
#florrick_fields ⇒ Object
Return a hash for all florrick fields which have been defined for this model.
-
#string_interpolation_for?(var) ⇒ Boolean
Return whether or not a given key can be replaced.
-
#string_interpolation_relationship_for?(var) ⇒ Boolean
Return whether or not a given relationship key can be replaced.
Instance Method Details
#florrick(&block) ⇒ Object
Accept a new set of configuration for this model
33 34 35 36 37 |
# File 'lib/florrick/active_record_extension.rb', line 33 def florrick(&block) dsl = Florrick::DSL.new(self) dsl.instance_eval(&block) dsl end |
#florrick_fields ⇒ Object
Return a hash for all florrick fields which have been defined for this model
26 27 28 |
# File 'lib/florrick/active_record_extension.rb', line 26 def florrick_fields @florrick_fields ||= {:strings => {}, :relationships =>{}} end |
#string_interpolation_for?(var) ⇒ Boolean
Return whether or not a given key can be replaced
42 43 44 |
# File 'lib/florrick/active_record_extension.rb', line 42 def string_interpolation_for?(var) florrick_fields[:strings].keys.include?(var.to_sym) end |
#string_interpolation_relationship_for?(var) ⇒ Boolean
Return whether or not a given relationship key can be replaced
49 50 51 |
# File 'lib/florrick/active_record_extension.rb', line 49 def string_interpolation_relationship_for?(var) florrick_fields[:relationships].keys.include?(var.to_sym) end |