Module: DirModel::Import
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/dir_model/import.rb,
lib/dir_model/import/dir.rb,
lib/dir_model/import/path.rb
Defined Under Namespace
Modules: ClassMethods Classes: Dir, Path
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#foreign_value ⇒ Object
readonly
Returns the value of attribute foreign_value.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#previous ⇒ Object
readonly
Returns the value of attribute previous.
-
#source_path ⇒ Object
readonly
Returns the value of attribute source_path.
Instance Method Summary collapse
- #initialize(path, options = {}) ⇒ Object
- #method_missing(name, *args, &block) ⇒ Object
- #skip? ⇒ Boolean
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/dir_model/import.rb', line 20 def method_missing(name, *args, &block) load @_match[name] rescue super end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
5 6 7 |
# File 'lib/dir_model/import.rb', line 5 def context @context end |
#foreign_value ⇒ Object (readonly)
Returns the value of attribute foreign_value.
5 6 7 |
# File 'lib/dir_model/import.rb', line 5 def foreign_value @foreign_value end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
5 6 7 |
# File 'lib/dir_model/import.rb', line 5 def index @index end |
#previous ⇒ Object (readonly)
Returns the value of attribute previous.
5 6 7 |
# File 'lib/dir_model/import.rb', line 5 def previous @previous end |
#source_path ⇒ Object (readonly)
Returns the value of attribute source_path.
5 6 7 |
# File 'lib/dir_model/import.rb', line 5 def source_path @source_path end |
Instance Method Details
#initialize(path, options = {}) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/dir_model/import.rb', line 7 def initialize(path, ={}) super # set parent @source_path, @context = path, OpenStruct.new([:context]) @index, @previous = [:index], [:previous].try(:dup) @load_state = :ghost @foreign_value = [:foreign_value] end |
#skip? ⇒ Boolean
15 16 17 18 |
# File 'lib/dir_model/import.rb', line 15 def skip? load !@_match end |