Class: Wakari::Proxy::Base
- Inherits:
-
Object
- Object
- Wakari::Proxy::Base
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::MassAssignmentSecurity
- Defined in:
- lib/wakari/models/proxy.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
Instance Method Summary collapse
- #dom_id(prefix = nil) ⇒ Object
-
#initialize(content) ⇒ Base
constructor
A new instance of Base.
- #inspect ⇒ Object
- #method_missing(*args, &block) ⇒ Object
-
#write(params = {}) ⇒ Object
def translations _translations_proc.call(content) end.
Constructor Details
#initialize(content) ⇒ Base
Returns a new instance of Base.
14 15 16 |
# File 'lib/wakari/models/proxy.rb', line 14 def initialize(content) @content = content end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
32 33 34 |
# File 'lib/wakari/models/proxy.rb', line 32 def method_missing(*args, &block) current_translation.send(*args, &block) end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
8 9 10 |
# File 'lib/wakari/models/proxy.rb', line 8 def content @content end |
Instance Method Details
#dom_id(prefix = nil) ⇒ Object
36 37 38 |
# File 'lib/wakari/models/proxy.rb', line 36 def dom_id(prefix = nil) [prefix, content.dom_id, translations.klass.dom_class].compact.join("_") end |
#inspect ⇒ Object
28 29 30 |
# File 'lib/wakari/models/proxy.rb', line 28 def inspect translations.inspect end |
#write(params = {}) ⇒ Object
def translations
_translations_proc.call(content)
end
22 23 24 25 26 |
# File 'lib/wakari/models/proxy.rb', line 22 def write(params={}) detect_current_translation.tap do |t| t.attributes = params.delete_if {|k| k.to_s == "locale"} end end |