Class: FormKeeper::Messages
- Inherits:
-
Object
- Object
- FormKeeper::Messages
- Defined in:
- lib/formkeeper.rb
Constant Summary collapse
- DEFAULT_ACTION_NAME =
'DEFAULT'
- DEFAULT_CONSTRAINT_NAME =
'DEFAULT'
Class Method Summary collapse
Instance Method Summary collapse
- #get(action_name, target_name, constraint_name) ⇒ Object
-
#initialize(data) ⇒ Messages
constructor
A new instance of Messages.
Constructor Details
#initialize(data) ⇒ Messages
Returns a new instance of Messages.
374 375 376 |
# File 'lib/formkeeper.rb', line 374 def initialize(data) @data = data end |
Class Method Details
.from_file(path) ⇒ Object
370 371 372 373 |
# File 'lib/formkeeper.rb', line 370 def self.from_file(path) data = YAML.load_file(path) self.new(data) end |
Instance Method Details
#get(action_name, target_name, constraint_name) ⇒ Object
377 378 379 380 381 382 383 384 385 386 387 388 389 |
# File 'lib/formkeeper.rb', line 377 def get(action_name, target_name, constraint_name) if @data.has_key?(action_name.to_s) action = @data[action_name.to_s] return search_from_action_part(action, target_name, constraint_name) else if @data.has_key?(DEFAULT_ACTION_NAME) action = @data[DEFAULT_ACTION_NAME] return search_from_action_part(action, target_name, constraint_name) else return (target_name) end end end |