Class: Settings
- Inherits:
-
Object
- Object
- Settings
- Defined in:
- lib/lokale/options.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(actions) ⇒ Settings
constructor
A new instance of Settings.
Constructor Details
#initialize(actions) ⇒ Settings
Returns a new instance of Settings.
64 65 66 |
# File 'lib/lokale/options.rb', line 64 def initialize(actions) @actions = actions end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
22 23 24 |
# File 'lib/lokale/options.rb', line 22 def actions @actions end |
Class Method Details
.get ⇒ Object
59 60 61 62 |
# File 'lib/lokale/options.rb', line 59 def self.get init if @shared_settings.nil? @shared_settings end |
.init ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/lokale/options.rb', line 24 def self.init actions = [] OptionParser.new do |opts| opts. = "Usage: lokale [-bsh]" opts.on("-b", "--copy-base", "Copies 'en' localization files to 'Base'") do |n| actions << Action.copy_base end opts.on("-s", "--summary", "Prints project summary") do |n| actions << Action.summary end opts.on("-a", "--append", "Appends new strings to english localization file") do |n| actions << Action.append end opts.on("-h", "--help", "Prints this help") do puts opts exit end end.parse! if actions.empty? actions << Action.summary else actions.sort_by! { |e| -e.precedence } end @shared_settings = Settings.new(actions) end |