Class: ConditionalMessages::Directory
- Inherits:
-
Object
- Object
- ConditionalMessages::Directory
- Defined in:
- lib/conditional_messages/directory.rb
Constant Summary collapse
- EXTENSION =
".rb"
Instance Attribute Summary collapse
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
Instance Method Summary collapse
-
#initialize(name) ⇒ Directory
constructor
A new instance of Directory.
- #load ⇒ Object
Constructor Details
#initialize(name) ⇒ Directory
Returns a new instance of Directory.
10 11 12 |
# File 'lib/conditional_messages/directory.rb', line 10 def initialize(name) @directory = Pathname(name) end |
Instance Attribute Details
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
8 9 10 |
# File 'lib/conditional_messages/directory.rb', line 8 def directory @directory end |
Instance Method Details
#load ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/conditional_messages/directory.rb', line 14 def load files.each do |file| name = file.basename(EXTENSION).to_s code = directory.join(file).read collection.category(name).define(code) end collection end |