Module: PlainRecord::Extra::Git::Model

Defined in:
lib/plain_record/extra/git.rb

Instance Method Summary collapse

Instance Method Details

#git_created_timeObject

Filter to set default value to time of first file git commit. If file is not commited or has changes, filter will return Time.now.



82
83
84
85
86
87
88
89
90
# File 'lib/plain_record/extra/git.rb', line 82

def git_created_time
  proc do |model, name, type|
    model.add_accessors <<-EOS, __FILE__, __LINE__
      def #{name}
        super || first_git_commit
      end
    EOS
  end
end

#git_modified_timeObject

Filter to set default value to time of last file git commit. If file is not commited or has changes, filter will return Time.now.



70
71
72
73
74
75
76
77
78
# File 'lib/plain_record/extra/git.rb', line 70

def git_modified_time
  proc do |model, name, type|
    model.add_accessors <<-EOS, __FILE__, __LINE__
      def #{name}
        super || last_git_commit
      end
    EOS
  end
end