Class: Luruju::JudeApi::JudeBase
- Inherits:
-
Object
- Object
- Luruju::JudeApi::JudeBase
- Includes:
- DynamicMethod
- Defined in:
- lib/luruju/jude_api/jude_base.rb,
lib/luruju/jude_api/add_dynamic_method.rb
Instance Attribute Summary collapse
-
#members ⇒ Object
readonly
Returns the value of attribute members.
- #tagged ⇒ Object
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(members) ⇒ JudeBase
constructor
A new instance of JudeBase.
- #inspect ⇒ Object
- #search(options = {}, &block) ⇒ Object
Methods included from DynamicMethod
Constructor Details
#initialize(members) ⇒ JudeBase
Returns a new instance of JudeBase.
12 |
# File 'lib/luruju/jude_api/jude_base.rb', line 12 def initialize(members) @members = members end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Luruju::DynamicMethod
Instance Attribute Details
#members ⇒ Object (readonly)
Returns the value of attribute members.
10 11 12 |
# File 'lib/luruju/jude_api/jude_base.rb', line 10 def members @members end |
#tagged ⇒ Object
18 19 20 21 22 23 |
# File 'lib/luruju/jude_api/jude_base.rb', line 18 def tagged return @tagged if @tagged @tagged = HashWithIndifferentAccess.new tagged_values.each {|x| @tagged[x.key.to_sym] = x.value} @tagged end |
Class Method Details
.search(members, options = {}) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/luruju/jude_api/jude_base.rb', line 25 def self.search members, ={} members.collect do |member| if .key?(:name) next unless member.is_a?(JudeNamedElementMethods) next unless member.name == [:name] end next if .key?(:id) and member.id != [:id] if block_given? next unless yield(member) end member end.compact end |
Instance Method Details
#inspect ⇒ Object
39 |
# File 'lib/luruju/jude_api/jude_base.rb', line 39 def inspect() "<#{self.class}: id=#{self.instance_eval('@id')}>" end |