Class: Puppet::Indirector::ActiveRecord
- Defined in:
- lib/vendor/puppet/indirector/active_record.rb
Direct Known Subclasses
Node::ActiveRecord, Node::Facts::ActiveRecord, Node::Facts::InventoryActiveRecord, Resource::ActiveRecord, Resource::Catalog::ActiveRecord
Constant Summary
Constants included from Util
Util::AbsolutePathPosix, Util::AbsolutePathWindows
Constants included from Util::Docs
Class Attribute Summary collapse
-
.ar_model ⇒ Object
Returns the value of attribute ar_model.
Attributes included from Util::Docs
Class Method Summary collapse
Instance Method Summary collapse
- #ar_model ⇒ Object
- #find(request) ⇒ Object
-
#initialize ⇒ ActiveRecord
constructor
A new instance of ActiveRecord.
- #save(request) ⇒ Object
Methods inherited from Terminus
abstract_terminus?, const2name, #indirection, indirection_name, inherited, mark_as_abstract_terminus, #model, model, #name, name2const, register_terminus_class, terminus_class, terminus_classes, #terminus_type
Methods included from Util::InstanceLoader
#instance_docs, #instance_hash, #instance_load, #instance_loader, #instance_loading?, #loaded_instance, #loaded_instances
Methods included from Util
absolute_path?, activerecord_version, benchmark, binread, chuser, classproxy, #execfail, #execpipe, execute, execute_posix, execute_windows, logmethods, memory, path_to_uri, proxy, replace_file, safe_posix_fork, symbolize, symbolizehash, symbolizehash!, synchronize_on, thinmark, #threadlock, uri_to_path, wait_for_output, which, withumask
Methods included from Util::POSIX
#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid
Methods included from Util::Docs
#desc, #dochook, #doctable, #markdown_definitionlist, #markdown_header, #nodoc?, #pad, scrub
Constructor Details
#initialize ⇒ ActiveRecord
Returns a new instance of ActiveRecord.
16 17 18 |
# File 'lib/vendor/puppet/indirector/active_record.rb', line 16 def initialize Puppet::Rails.init end |
Class Attribute Details
.ar_model ⇒ Object
Returns the value of attribute ar_model.
5 6 7 |
# File 'lib/vendor/puppet/indirector/active_record.rb', line 5 def ar_model @ar_model end |
Class Method Details
.use_ar_model(klass) ⇒ Object
8 9 10 |
# File 'lib/vendor/puppet/indirector/active_record.rb', line 8 def self.use_ar_model(klass) self.ar_model = klass end |
Instance Method Details
#ar_model ⇒ Object
12 13 14 |
# File 'lib/vendor/puppet/indirector/active_record.rb', line 12 def ar_model self.class.ar_model end |
#find(request) ⇒ Object
20 21 22 23 |
# File 'lib/vendor/puppet/indirector/active_record.rb', line 20 def find(request) return nil unless instance = ar_model.find_by_name(request.key) instance.to_puppet end |
#save(request) ⇒ Object
25 26 27 |
# File 'lib/vendor/puppet/indirector/active_record.rb', line 25 def save(request) ar_model.from_puppet(request.instance).save end |