lib/policy/cli.rb in policy-1.2.0 vs lib/policy/cli.rb in policy-2.0.0
- old
+ new
@@ -1,11 +1,16 @@
# encoding: utf-8
+
require "hexx-cli"
+require_relative "cli/attribute"
+
module Policy
# Scaffolds a policy with a specification and translations
+ #
+ # @api private
class CLI < Hexx::CLI::Base
# @private
def self.source_root
::File.expand_path "../cli", __FILE__
@@ -22,13 +27,13 @@
)
class_option(
:attributes,
aliases: %w(-a),
- banner: " debet credit",
+ banner: " debet{Transaction} credit{Transaction}",
default: %w(),
- desc: "The list of attributes of the policy (the order is essential).",
+ desc: "The list of policy object's attributes.",
type: :array
)
class_option(
:namespace,
@@ -75,10 +80,10 @@
def policy
@policy ||= Hexx::CLI::Name.new [options[:namespace], name].join("/")
end
def attributes
- @attributes ||= options[:attributes].map(&:downcase)
+ @attributes ||= options[:attributes].map(&Attribute.method(:new))
end
def locales
@locales ||= options[:locales].map(&:downcase)
end