Class: ActiveGist::Files
- Inherits:
-
Object
- Object
- ActiveGist::Files
- Defined in:
- lib/active_gist/files.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
Instance Method Summary collapse
- #changed? ⇒ Boolean
-
#initialize(hash = {}) ⇒ Files
constructor
A new instance of Files.
- #method_missing(name, *args, &block) ⇒ Object
- #replace_with(hash) ⇒ Object
Constructor Details
#initialize(hash = {}) ⇒ Files
Returns a new instance of Files.
6 7 8 9 |
# File 'lib/active_gist/files.rb', line 6 def initialize(hash = {}) @hash = hash @changed = false end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
22 23 24 |
# File 'lib/active_gist/files.rb', line 22 def method_missing(name, *args, &block) hash.send name, *args, &block end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
2 3 4 |
# File 'lib/active_gist/files.rb', line 2 def hash @hash end |
Instance Method Details
#changed? ⇒ Boolean
11 12 13 |
# File 'lib/active_gist/files.rb', line 11 def changed? @hash_copy != hash end |
#replace_with(hash) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/active_gist/files.rb', line 15 def replace_with(hash) return hash if hash == @hash @changed = true @hash_copy = deep_dup hash @hash = hash end |